-
Notifications
You must be signed in to change notification settings - Fork 961
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
Add a link API that navigates without duplicating paths #617
Conversation
4f7765c
to
fb34aa6
Compare
Thanks for the PR, @sximba. I definitely want to resolve this in our next release, 4.8. Question: are you also using React Router? Or are you using the history library with something else? |
@mjackson I am using React Router |
modules/LocationUtils.js
Outdated
location.pathname === nextLocation.pathname && | ||
location.search === nextLocation.search && | ||
location.hash === nextLocation.hash && | ||
valueEqual(location.state, nextLocation.state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state
shouldn't be compared; replicating how an anchor work only depends on the "visible" location properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
2e4e774
to
9bab68e
Compare
that's great, why this wasn't merged yet? |
After thinking about this more, this is definitely a problem I want to solve in the router, not here. A I know it's a little frustrating since remix-run/react-router#6137 was already closed and we sent you over here. But thank you for your patience as we sort this out. Let's follow up in remix-run/react-router#5362 |
could you clarify why not add a way to programmatically do this with |
This PR adds a link API that can be used to closely match what browsers do when navigating to the current path, which is to replace instead of push.
I know #570 is already open but I saw no activity on it in a while. I addressed the comments on it.
This fixes a problem that a lot of people have and will allow dependant libraries to close long standing issues.
#470
#558
#507
remix-run/react-router#6137