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]: useRevalidate function not revalidating if url hash present #10512

Closed
ts213 opened this issue May 20, 2023 · 3 comments · Fixed by #10516
Closed

[Bug]: useRevalidate function not revalidating if url hash present #10512

ts213 opened this issue May 20, 2023 · 3 comments · Fixed by #10516
Labels

Comments

@ts213
Copy link

ts213 commented May 20, 2023

What version of React Router are you using?

6.11.2

Steps to Reproduce

https://codesandbox.io/s/bold-darkness-jnkngv
Click revalidate button multiple times.
Click link.
Click revalidate button multiple times again.

Expected Behavior

Loader for the current URL should be called regardless of the URL hash.

Actual Behavior

Loader doesn't get called if a url contains a hash.

@ts213 ts213 added the bug label May 20, 2023
@akamfoad
Copy link
Contributor

I can confirm, you cannot revalidate when there is a hash in the link, this happens because react-router will short-circuit and return early if the navigation goes to the same hash (same link with same hash should not trigger reload in Web, or re-validation in RR) but manual re-validation trigger should not take hashes into account. I think this is what causes this behavior

https://github.com/akamfoad/react-router/blob/edf6dca2c6dde5e86f2e3e3ae8b62996d87f4ab3/packages/router/router.ts#L1228-L1240

@brophdawg11
Copy link
Contributor

This is fixed by #10516 and will be available once the next release goes out - likely 6.12.0

@brophdawg11 brophdawg11 added the awaiting release This issue have been fixed and will be released soon label May 23, 2023
@brophdawg11
Copy link
Contributor

This is released in 6.12.0This is released in 6.12.0

@brophdawg11 brophdawg11 removed the awaiting release This issue have been fixed and will be released soon label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants