1 00:00:01,600 --> 00:00:03,740 Let's take care of an easy fix first. 2 00:00:04,270 --> 00:00:08,350 Right now, if we delete everything inside that input, we get a nasty error like this one right here. 3 00:00:08,990 --> 00:00:13,030 So this is because we are doing a search with an empty string. 4 00:00:13,570 --> 00:00:17,980 You might recall that we spoke about this a little bit ago and we ended up with a default search term 5 00:00:17,980 --> 00:00:22,120 right here that we made use of a default search term just to make sure that we wouldn't do a search 6 00:00:22,180 --> 00:00:24,880 without any content inside of it or no search term. 7 00:00:25,660 --> 00:00:28,420 So we're going to restore that same kind of fix we put in previously. 8 00:00:28,540 --> 00:00:32,680 We'll say that we only want to run a search if there is a term. 9 00:00:33,340 --> 00:00:35,870 So if term is empty string, don't do a search at all. 10 00:00:36,580 --> 00:00:40,000 Otherwise, if we've got some term defined, go ahead and run the search. 11 00:00:41,070 --> 00:00:42,060 Let's try to save this now. 12 00:00:43,290 --> 00:00:44,820 Now, if I delete everything. 13 00:00:45,730 --> 00:00:47,360 The page just stays the same. 14 00:00:47,490 --> 00:00:48,680 And it's only when I start to type. 15 00:00:49,780 --> 00:00:51,770 That I start to do some more searches. 16 00:00:53,050 --> 00:00:53,950 That's an easy fix. 17 00:00:54,160 --> 00:00:59,620 But now let's make sure that we take care of not making quite so many requests off to that API in just 18 00:00:59,620 --> 00:00:59,920 a moment.