-
-
Notifications
You must be signed in to change notification settings - Fork 876
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
Avoid removing navigate from route loader #3844
Comments
please provide a complete minimal example of what you need this for. ideally fork one of the existing stackblitz examples |
Hello @schiller-manuel I understand the need for samples but I don't think building a sample here is helpful. The issue of throwing instead of being able to use navigate() in loader means we can NOT load data AND redirect but instead it would redirect only AFTER having loaded the data then it would load the same data again. Currently we use the navigate() prop and it works perfectly. |
still would like to see how this is being used |
We're basically using root routes with sub routes. The root route loads the main data and supplies it via react context to is sub routes to avoid loading for every route. shouldReload:false is set on the root to do that only once with subsequent nested routing. However, the data loaded by the root defines which nested view we need to redirect to initially. Now if we'd throw it redirects but the data is loaded again eventhough it already existed. Using navigate prop we avoid throwing in the loader and can return its data. |
Which project does this relate to?
Router
Describe the bug
Currently the "navigate" property is marked as deprecated on the loader and it is advised to use throw redirect() instead. However I think this is a bug because there's a hug difference --> when we throw, we can not return loaded date from a root route while with the navigate property we get exactly this, we can navigate to a sub route after having loaded some data and return the actually loaded data so I think we need both features.
Your Example Website or App
https://stackoverflow.com/help/mcve
Steps to Reproduce the Bug or Issue
See the navigate property of the loader properties marked as deprecated
Expected behavior
Should not be marked deprecated and not be removed because it serves a completely different purpose than the throw redirect()
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: