You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue with nested data fetching. If a nested route is hit then the hooks in the parent route are also hit. This results in two requests for data when I only care about the nested route making a call for data.
Ive seen this solution to this problem: #16. Although I don't think this solves this problem fully. What about the case where a parent route is hit, then a nested child route is hit (at this point only the child route would make a request for data), but if I ever went back to the parent route again then data would not be fetched as its state is still populated from the first hit.
Is there anyway using react router to determine the route of the current component thats being rendered? In this case it would be the parent route, and compare this against the requested route (the child component). If this was possible I would be able to compare the two routes and only dispatch actions in my redial hooks when the requested route and current route are the same.
Thanks
The text was updated successfully, but these errors were encountered:
ghost
changed the title
Nested routes, prevent data fetching in parent component if child component is rendered.
Nested routes, prevent data fetching in parent route if nested route within the parent route is hit.
Jan 31, 2017
I'm having an issue with nested data fetching. If a nested route is hit then the hooks in the parent route are also hit. This results in two requests for data when I only care about the nested route making a call for data.
Ive seen this solution to this problem: #16. Although I don't think this solves this problem fully. What about the case where a parent route is hit, then a nested child route is hit (at this point only the child route would make a request for data), but if I ever went back to the parent route again then data would not be fetched as its state is still populated from the first hit.
Is there anyway using react router to determine the route of the current component thats being rendered? In this case it would be the parent route, and compare this against the requested route (the child component). If this was possible I would be able to compare the two routes and only dispatch actions in my redial hooks when the requested route and current route are the same.
Thanks
The text was updated successfully, but these errors were encountered: