Players page: remember each player's filters and explored line too - #289
Open
jozef2svrcek wants to merge 2 commits into
Open
jozef2svrcek wants to merge 2 commits into
jozef2svrcek wants to merge 2 commits into
Conversation
#288 remembered only the selected game and move per player; the colour filters, opponent, event, dates and the move line explored under them were left out on purpose, and coming back from Analysis lost them. They're visible in the Filters panel, so remembering them can't hide games, and they are exactly the setup you come back for. - lib/playerViewState keeps the whole view per player (validated field by field; views saved by 0.17.0 still load, the rest falls back to defaults). - The view starts from the player's saved state on mount (restored ?? savedView), so the effect that clears the line under "Any", which runs on mount too, can't wipe a restored line. - A player switch restores that player's view, or EMPTY_PLAYER_VIEW for a new player instead of inheriting the previous player's filters. - Save every remembered field, still keyed by viewOwner. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4Dx2ACk3LrQbspzrQaZVN
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P4Dx2ACk3LrQbspzrQaZVN
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.
The problem
On the Players page, set up a view and then Open in Analysis. Coming back loses the setup: the game list returns unfiltered and the explored line is gone. In the reported case, the setup was Player B, Opponent W, the explored line
1. c4 e6→2. g3, and a selected game.#288 (in v0.17.0) remembers only the selected game and move per player. The filters and the explored line were left out on purpose, so a forgotten filter couldn't silently hide games. That was the wrong trade-off:
Changes
lib/playerViewState.tsEMPTY_PLAYER_VIEW.GamesPage.tsx, first renderrestored ?? savedViewfeeds every remembered field's initial state). This matters: the effect that clears the explored line when the colour is "Any" also runs on mount. Had the saved view been applied only in the player effect, that clear would have queued after it in the same commit and wiped the restored line.GamesPage.tsx, player switchEMPTY_PLAYER_VIEWfor a player seen for the first time. Until now a new player inherited the previous player's filters.GamesPage.tsx, saveviewOwner(whose view is on screen), so a switch can't file one player's view under another.Not remembered per player: the Collection filter, which is shared across pages and already survives navigation, and whether the Filters panel is folded, which stays one app-wide setting.
Verification
npx tsc --noEmit: clean.npm run build: succeeds.lib/playerViewState.tsunder Node with an in-memorylocalStorage: 9/9 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01P4Dx2ACk3LrQbspzrQaZVN