1 00:00:01,000 --> 00:00:04,870 Our application is now working pretty darn well but there's still many different things we could probably 2 00:00:04,870 --> 00:00:05,900 polish up. 3 00:00:06,040 --> 00:00:10,840 So I'm sure you can look at this application and find like a dozen different things so we can probably 4 00:00:10,840 --> 00:00:11,850 improve. 5 00:00:11,890 --> 00:00:15,790 However I don't want to sit here working on the same application forever and I'm sure you don't either. 6 00:00:16,060 --> 00:00:19,330 So we're just gonna take care of one little improvement very quickly. 7 00:00:19,330 --> 00:00:23,430 So here's the improvement I want to make right now when our application first loads up. 8 00:00:23,560 --> 00:00:25,000 We have to sit here for just a second. 9 00:00:25,000 --> 00:00:29,680 With all the section headers in place before all the content actually loads. 10 00:00:29,680 --> 00:00:35,890 So I want to make sure that if we don't have anything to show here I want to just hide an entire section. 11 00:00:35,890 --> 00:00:40,300 In addition you might notice that if you search for some given restaurant or some given search term 12 00:00:40,300 --> 00:00:46,650 here like I'll try maybe steak in some cases we might get a restaurant category without any results. 13 00:00:46,660 --> 00:00:52,030 In this case I get one for every category here but I'll try something like say fast food and hopefully 14 00:00:52,030 --> 00:00:54,130 there's no like big spender fast food. 15 00:00:54,130 --> 00:00:58,600 Yeah there's definitely not so in this case we don't have any results for big spender so we would probably 16 00:00:58,600 --> 00:01:00,280 want to hide that entire section. 17 00:01:00,580 --> 00:01:03,480 So let's figure out how to do that all right. 18 00:01:03,480 --> 00:01:06,510 So I'm going to open up my results list component. 19 00:01:06,510 --> 00:01:07,860 Here it is right here. 20 00:01:07,860 --> 00:01:11,800 Remember this component is responsible for showing one of those sections. 21 00:01:11,910 --> 00:01:17,190 So I think an easy way that we can fix up this issue of not showing a title when we don't have any data 22 00:01:17,580 --> 00:01:22,530 would be to just add a very simple check to this component right above our return statement. 23 00:01:22,530 --> 00:01:31,770 We could say if there are no results length so we're essentially saying here if results dot 0 or similar 24 00:01:31,770 --> 00:01:34,940 result results got a bad type of there. 25 00:01:34,940 --> 00:01:36,450 There we go results dot length. 26 00:01:36,450 --> 00:01:39,780 If that is zero where then going to flip it over to true. 27 00:01:39,780 --> 00:01:42,740 So if we don't have any results then we're just going to return. 28 00:01:42,750 --> 00:01:43,550 No. 29 00:01:43,560 --> 00:01:46,050 And then essentially means don't show anything at all. 30 00:01:46,620 --> 00:01:47,870 So I'll save this. 31 00:01:47,970 --> 00:01:52,980 And now when our application first loads up we don't see anything until we actually fetch some data. 32 00:01:52,980 --> 00:01:59,740 And once again if I search for fast food I'm not going to see that big spender category at the bottom 33 00:01:59,750 --> 00:02:01,730 that actually is empty. 34 00:02:01,800 --> 00:02:04,820 Okay so that's pretty much it pretty darn easy fix. 35 00:02:04,820 --> 00:02:06,950 I can test this out on Android really quickly as well. 36 00:02:06,950 --> 00:02:11,040 Do fast food and yep get the same thing. 37 00:02:11,040 --> 00:02:11,330 All right. 38 00:02:11,340 --> 00:02:12,540 So very good. 39 00:02:12,540 --> 00:02:16,350 Well I hope you enjoyed this application together but we've still got a lot of other stuff to work on 40 00:02:16,620 --> 00:02:20,370 so let's take a quick pause right here and start working on our next app in the next video.