Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested routes, prevent data fetching in parent route if nested route within the parent route is hit. #46

Closed
ghost opened this issue Jan 31, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented 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

@ghost 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
@ghost ghost closed this as completed Mar 17, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants