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

Fix clearing query params when navigating #1097

Merged
merged 1 commit into from
Nov 10, 2024
Merged

Conversation

wwwillchen
Copy link
Collaborator

@wwwillchen wwwillchen commented Nov 8, 2024

The previous implementation had a flaw where it issued a command to clear the query params which resulted in replacing the browser history entry, which means that back navigations would not restore the original query params. (The e2e test case demonstrates this issue).

@wwwillchen wwwillchen requested a review from richard-to November 9, 2024 05:13
@wwwillchen wwwillchen marked this pull request as ready for review November 9, 2024 05:13
Copy link
Collaborator

@richard-to richard-to left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does using the query params in the runtime context preserve the query params when going back?

@wwwillchen
Copy link
Collaborator Author

Why does using the query params in the runtime context preserve the query params when going back?

The problem was that previously we were doing me.query_params.clear() which issued a clear query param command which modified the browser history. By directly deleting the query params from context, we avoid issuing this command, and thus not modifying the query param in the browser history.

@wwwillchen wwwillchen merged commit 3d6028f into google:main Nov 10, 2024
6 checks passed
@wwwillchen wwwillchen deleted the fix-nav branch November 10, 2024 00:29
@richard-to
Copy link
Collaborator

The problem was that previously we were doing me.query_params.clear() which issued a clear query param command which modified the browser history. By directly deleting the query params from context, we avoid issuing this command, and thus not modifying the query param in the browser history.

Ah thanks for the explanation. That makes sense now.

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