Repository navigation
fix(viewer): make the explorer, shell, popover and export states explicit - #79
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
🎉 This PR is included in version 0.7.0-rc.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Merged
Contributor
|
🎉 This PR is included in version 0.7.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This branch was successfully deployed
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
Four pieces of viewer state were implicit state machines: separate flags whose valid combinations were kept only by scattered guards. Each one is now explicit. Two of them were hiding bugs.
Explorer mode: trace and route picking excluded each other only through reducer guards, and 8 call sites (viewer and site) repeated
!!state.route || !!state.routing.interface ExploreState { - trace: boolean; - route: { from; to } | null; - routing: { next: 'from' } | { next: 'to'; start } | null; + mode: + | { kind: 'neighbours' } // default + | { kind: 'trace' } + | { kind: 'pickStart' } // R + | { kind: 'pickEnd'; from } + | { kind: 'route'; from; to }; // the only one in the hash } +isRouting(mode) // pickStart | pickEnd | route +routeOf(mode) // the route mode itself (stable identity for deps), else nullThe hash format is unchanged.
Shell: focus (Z), presentation (F) and the hidden toolbar (H) were four
useStates plus a ref mirror. The rules now live in a pure reducer:Toolbar popovers (fix): search and the type filter were kept apart only by click handlers. The website's "Find" try button opens search through the explorer, so opening the filter from the keyboard and then pressing Find stacked both popovers. Now
lensShown = lensOpen && !searchOpen: search wins, in one place.Export status (fix):
idle → busy → done | errornever returned to idle, so a failed export's note stayed indefinitely and the reopened menu was drawn on top of it. Opening the menu now resets the status.Evidence
useTryon the new mode).Merge Danger
Door: two-way
The state shape is internal to
@stackmap/viewer, and the only consumer outside it is the site'suseTry, updated here. Nothing persisted or published changes shape: the URL hash and the CLI are untouched.Blast Radius: viewer-interactions
If something regressed, it would show in trace and route picking, presentation, focus and hidden-toolbar keys, or the export menu. Rendering and layout aren't touched, and no visual baselines changed.