Fixing the Archive Render Error
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

[00:00:01] Hi and welcome back to the report that we're building in this guy. We are going to fix this error. You keep getting the cons.. Whenever we go back to newsletter. So just to replicate it I'm going to refresh the page refresh the page and your name. Look at it and then I'm going at it and I'm going to cancel. Let me get there and all these render so pretty simple fix. Oh we have to do is first close out all of our files and then head to newsletter J.S. or newsletter archive digests and then here. Let's look at how we're fetching our items or at least pushing them on. So every time render runs we are running this function and it says Okay if this not and archived. So if we have an archive and our props which we do because we're passing it from our newsletter digests in his archive every time we have we want to map over to the right. So whenever rebounders whenever we go back to that now it's pushing it back on and we don't want that. There's a couple of things we can do but the one thing I will focus on is by putting this on component will receive proper props and there's there's other fixes to this but this is just one that stood out to me. I kind like. So let's just cut this and put it in and then we can actually get rid of this call and then just get it to a function in its entirety. [00:01:29][88.9]
[00:01:31] Now instead of saying this thought process we're going to say next prompts so that we're getting the next prompts whenever whenever the prompts are added to this. If we were to leave it as this process I don't think it would work. Let's test it out because well it might work because we're already out and the props indirectly but we should save the next props. Let's test it out and see if it's working. It's a newsletter and it doesn't work which is actually what I initially expected. So the reason that's working is because we don't have any props in only receiving the props one time that's when you're passing them into our newsletter right here so we can fix that by just naming the next prompts instead of just props and then this will only render one time now because it's independent will receive prompts not happening every time we are it and then items will always be the same except for maybe actually this isn't a good way to do this. Matthew refractor this because I just realized if we're adding something to add one of these articles which we have had functionality and then we go back it's not going to render the new data because this is only running one time. So in the future to make this a little bit different so that it will basically replace these items instead of running them once. So right now though you won't be able to notice any difference. All you'll notice is that the error is gone. So we'll get around to that when it becomes relevant. So we added some content here and then say it brought back it's all updated and there's no errors everything's great. [00:03:23][111.6]
[00:03:23] So that fixes that say get status get that once they get it fixed the render error archive component. And I'll catch you the next guy where we will get started on the next feature. [00:03:23][0.0]
[200.5]