Skip to content

fix: notify WindowHistoryAdapter when the page's URL is updated #296

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

am1rb
Copy link

@am1rb am1rb commented Dec 30, 2024

Fixes the issue rained here: #283

WindowHistoryAdapter is broken because when a component updates a query param in the URL, the lib does not notify the query params consumer to read the new value. As a result, the URL is changed, but the internal react state holds the stale value.

Also, the adapter needs to consider URL changes when someone clicks on the browser's Back and Forward buttons.

PS: My solution was also broken, and finally I ended up with the same idea as @websaid shared in #283 (comment)

This is a PR to add his solution to the repo.

@am1rb am1rb force-pushed the fix-window-adapter branch from b55ae6d to 0987512 Compare December 30, 2024 13:35
@am1rb am1rb force-pushed the fix-window-adapter branch from 0987512 to a1d9c6a Compare December 30, 2024 14:38
@websaid
Copy link

websaid commented Dec 30, 2024

LGTM. We have this in production for a year now and it is working well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants