1 00:00:00,790 --> 00:00:05,050 In the last couple of videos I've mentioned that there is a little problem with our application. 2 00:00:05,110 --> 00:00:09,010 And so in this video and it tell you exactly what that problem is and then will start to take a look 3 00:00:09,010 --> 00:00:11,980 at two different ways of solving that problem. 4 00:00:11,980 --> 00:00:15,150 All right so I'm going to open up my chrome Council right here. 5 00:00:15,250 --> 00:00:20,110 I'm going to find the network request tab and then I'm going to make sure that I'm filtering by x h 6 00:00:20,140 --> 00:00:21,770 our requests. 7 00:00:22,030 --> 00:00:25,840 Once I have that all selected and then going to it refreshed the page and we're going to take a look 8 00:00:26,020 --> 00:00:29,080 at the request that are being issued by our application. 9 00:00:29,080 --> 00:00:29,550 All right. 10 00:00:29,560 --> 00:00:31,960 So take a look at this at the very top. 11 00:00:31,960 --> 00:00:34,220 We've got our request to the post and point. 12 00:00:34,420 --> 00:00:38,390 And then after that we've got a request to get users slash 1. 13 00:00:38,440 --> 00:00:45,390 That means that we're getting the user ID number one and then the next request is also user with ID 14 00:00:45,430 --> 00:00:45,850 1. 15 00:00:46,030 --> 00:00:54,070 And then also user ID 1 and so on we are making request for user ID number one 10 times in a row and 16 00:00:54,070 --> 00:00:59,060 then we are doing the same thing with user ID number 2 and 3 and 4 and so on. 17 00:00:59,080 --> 00:01:05,060 In total we are making a hundred separate requests to fetch just 10 individual users. 18 00:01:05,080 --> 00:01:06,240 So what's going wrong here. 19 00:01:07,330 --> 00:01:13,780 Well remember we are showing one instance of the user Hetter component for every single blog post that 20 00:01:13,780 --> 00:01:19,300 we fetch every time that a user header is rendered on the screen component amount is called in and so 21 00:01:19,300 --> 00:01:24,510 we call this action creator fecche user with this particular user ID. 22 00:01:24,580 --> 00:01:29,590 So essentially because we are rendering out a hundred instances of user Hetter our action creator gets 23 00:01:29,590 --> 00:01:31,700 called a hundred different times. 24 00:01:31,720 --> 00:01:35,930 Even though we are fetching some very very repetitive data. 25 00:01:36,280 --> 00:01:43,090 So thats the issue we are fetching these users 10 times more often or frequently than we actually have 26 00:01:43,090 --> 00:01:43,470 to. 27 00:01:43,600 --> 00:01:48,270 Ideally we would only fetch each one of these user users exactly one time. 28 00:01:48,670 --> 00:01:53,230 So we are going to have to figure out some way to make sure that we dont make all these duplicate requests 29 00:01:53,320 --> 00:01:54,700 for each individual user. 30 00:01:54,700 --> 00:01:57,880 So thats the big challenge and that's what's wrong with our application right now. 31 00:01:57,880 --> 00:02:02,610 Now like I mentioned we're going to take a look at two different ways of solving this problem. 32 00:02:02,620 --> 00:02:08,470 Now there's kind of a I don't know kind of easy way and kind of the easy way I would not necessarily 33 00:02:08,470 --> 00:02:12,300 say that one method is significantly easier than the other. 34 00:02:12,340 --> 00:02:16,780 One way is just a tiny little code change that we're going to make but it involves some really crazy 35 00:02:16,780 --> 00:02:17,620 syntax. 36 00:02:17,830 --> 00:02:22,780 The other way is a much more complicated change but it's also much easier to understand what is going 37 00:02:22,780 --> 00:02:25,130 on and also take a pause right here. 38 00:02:25,180 --> 00:02:30,130 When we come back the next section we're going to try solving this problem using the quick code change 39 00:02:30,130 --> 00:02:34,660 that is kind of challenging to understand the syntax I'm making way too much of this list is take a 40 00:02:34,660 --> 00:02:36,250 pause like the change in the next video. 41 00:02:36,280 --> 00:02:37,550 So see you in just a minute.