feat(state-manager): persist cut state in Save/Load State (closes #863 part 2)#882
Open
deveshbervar wants to merge 2 commits intoHSF:mainfrom
Open
feat(state-manager): persist cut state in Save/Load State (closes #863 part 2)#882deveshbervar wants to merge 2 commits intoHSF:mainfrom
deveshbervar wants to merge 2 commits intoHSF:mainfrom
Conversation
… State - Add CutJSON interface and Cut.toJSON()/fromJSON() to Cut model - Expose getCollectionCuts()/setCollectionCuts() on PhoenixMenuUI - Add getPhoenixMenuUI() to UIManager public API - Extend StateManager.getStateAsJSON() to include active cuts - Add StateManager.restoreCutsFromJSON() called by loadStateFromJSON() - Extend cut.model.test.ts: toJSON, fromJSON, round-trip tests (8 new) - Extend state-manager.test.ts: cut serialization tests (9 new) Cuts applied before Save State are now fully restored on Load State. Works with PR HSF#872 (live re-application on event switch) to provide complete cut state persistence across both live sessions and saved files. 202 tests passing, 0 failing. Closes HSF#863 (part 2 - serialization)
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
Completes the fix for #863
PR #872 fixed cut re-application on live event switches (in-memory fix).
This PR adds the second half: cuts are now included in Save State and
fully restored by Load State, giving physicists persistent filter
configurations across sessions and page reloads.
Changes
cut.model.tsCutJSONinterface for type-safe serializationCut.toJSON()— serializes current slider state to a plain objectCut.fromJSON()— reconstructs a Cut instance from saved JSONphoenix-menu-ui.tsgetCollectionCuts()— exposes the cut registry to StateManagersetCollectionCuts()— allows StateManager to write restored cutsui-manager/index.tsgetPhoenixMenuUI()— exposes PhoenixMenuUI instance publiclystate-manager.tsgetStateAsJSON()now includes acutskeygetActiveCutsAsJSON()— collects and serializes active cutsrestoreCutsFromJSON()— deserializes and re-applies saved cutsloadStateFromJSON()calls restore whencutskey is presentBefore vs After
Before: Save State → page reload → Load State silently loses all
active filters
After: Save State captures cuts; Load State re-applies them exactly.
Verified: apply η < 0.5 on Tracks → Save State → refresh page →
Load State → slider still shows 0.5, cut correctly re-applied.
Testing
cut.model.test.ts: toJSON, fromJSON, round-tripstate-manager.test.ts: all serialization pathsNote:
phoenix-ngtest failures (dupMap.get is not a function) arepre-existing on
mainbefore this branch and unrelated to this PR.