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

[Bug]: Link to same page ignores replace prop #8777

Closed
williamsdyyz opened this issue Apr 7, 2022 · 1 comment
Closed

[Bug]: Link to same page ignores replace prop #8777

williamsdyyz opened this issue Apr 7, 2022 · 1 comment
Labels

Comments

@williamsdyyz
Copy link
Contributor

What version of React Router are you using?

6.2.2

Steps to Reproduce

Construct a Link like this

<Link to="." replace={false} state={newState}>
Show Modal
</Link>

Expected Behavior

With this link, I'm trying to push a new state while maintaining the current page so that the browser back button will revert the state

Actual Behavior

Clicking the link replaces the history entry instead of pushing. In other words, it ignores the replace={false} prop

In the code for useLinkClickHandler there is a comment "If the URL hasn't changed, a regular will do a replace instead of a push, so do the same here."

which makes sense, but only if the replace prop hasn't been explicitly set.

@tlylt
Copy link

tlylt commented Jan 12, 2023

This issue is already addressed by #8779 and can probably be closed now

@timdorr timdorr closed this as completed Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants