-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(router-core): Make buildLocation aware of explicitly defined from paths during navigation #4937
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # packages/react-router/tests/link.test.tsx
View your CI Pipeline Execution ↗ for commit fbe8fab
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
setting this as draft, we need to look into it a bit deeper. this solution is not ideal |
closing this in favour of #4978 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Everything documentation related
package: react-router
package: router-core
package: solid-router
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of commit #4573 we enhanced to process of determining when routes are changing, this especially enhanced the functioning of
to="."
route paths.It was assumed that routing to a
"."
path should only be required to reload the current location and any navigation to other routes should be done with explicitly defining an absolute or relative route in the"to"
path.While this is still the recommended option, #4842 has pointed out that this is an unintended regression and that certain circumstances might require applying the
to="."
navigation on explicitly defined"from"
route paths.This requires us to be aware of the fact that from is explicitly defined and that the
to="."
navigation should be applied on this specified location. Thefrom
location is unfortunately determined higher up in the chain, in the Link component and useNavigate hook, and the history of the source of thisfrom
location is therefore lost before the navigation location is built.This PR resolves #4842 by passing a new optional paramater "_isDefinedFrom" to the navigate function which in turn passes this to buildLocation. This enables buildLocation to make allowance for the fact that the
"from"
path is explicitly defined and uses this in determining if navigation is causing a route change or merely reloading the current location.This PR also adds an additional unit test on useNavigate to ensure the regression does not repeat in future. It also updates the documentation to reflect this added functionality as well as the recommended way of navigation to other locations.