fix: prevent browse page reset on back navigation in app#6390
Closed
stijnwtf wants to merge 1 commit into
Closed
Conversation
The pagination reset watcher fired on the initial filter setup (e.g. pushing a default server_game_version filter from an instance context), resetting currentPage to 1 before the page restored from the URL could be used. Guard the reset until after the first search completes.
Member
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds an initialization guard to prevent the browse search watcher from resetting pagination (currentPage) before the first search lifecycle has completed.
Changes:
- Introduces a
hasInitializedflag to gate the page-resetting watcher. - Marks initialization complete in a
finallyblock after the search routine finishes.
|
|
||
| let searchVersion = 0 | ||
| let searchDebounceTimer: ReturnType<typeof setTimeout> | null = null | ||
| let hasInitialized = false |
Comment on lines
+191
to
192
| if (!hasInitialized) return | ||
| currentPage.value = 1 |
Comment on lines
+252
to
254
| } finally { | ||
| hasInitialized = true | ||
| } |
|
|
||
| let searchVersion = 0 | ||
| let searchDebounceTimer: ReturnType<typeof setTimeout> | null = null | ||
| let hasInitialized = false |
Member
|
Do not submit AI generated pull requests, if you do this again you will be permanently blocked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useBrowseSearchresetscurrentPageto 1 whenever filters/sort/query change. This reset watcher also fired during the initial setup of the Browse page, when a defaultserver_game_versionfilter is pushed for the instance's game version, overwriting the page number restored from thebquery param before it could take effect.hasInitializedflag that only becomestrueafter the firstrefreshSearch()completes, so setup-time filter pushes no longer reset the page while user-driven filter changes still reset it as expected.Test plan