fix(graph): keep the focused node highlighted across tab switches - #764
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #764 +/- ##
=======================================
Coverage 99.69% 99.69%
=======================================
Files 548 548
Lines 22587 22590 +3
Branches 2467 2468 +1
=======================================
+ Hits 22519 22522 +3
Misses 17 17
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Bundle ReportChanges will increase total bundle size by 111 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: glyph-frontend-esmAssets Changed:
Files in
|
14 tasks
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
Clicking a node in the graph highlights it and its neighbourhood. Switching to another tab and back dropped that highlight, because the graph tab unmounts while inactive and the focused node lived only in component state. The camera and layout already survive the switch (#732); this keeps the focused node with them. Follow-up to #733.
Changes
graphViewStore: addfocusedIdto the per-workspace graph view state.useGraphFocus: take an optionalpersistKey, seed the focused node from the store on mount and write it back when it changes.GraphView: pass the workspace root aspersistKey.Risk classification
Invariants at stake and evidence
Session-only, in-memory state; nothing reaches disk. The focus rides the existing store lifecycle:
GraphView.test.tsx"comes back with the focused node still highlighted" (verified to fail without the fix).pruneGraphViewsdrops the whole entry, so a reopened graph starts unfocused.useGraphFocusclears it on the next mount.Testing
Automated gates only:
pnpm typecheck,pnpm check, fullpnpm test(3953 tests). No Rust changes. Not yet checked by hand in the running app.