feat(storybook): add DataVis NITRO WithPerspectives story - #416
Merged
Conversation
Bind a localStorage-backed datavis-ace Prefs module to the shared view so the perspective toolbar (Main Perspective dropdown, save/reset/history) renders in Storybook.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Storybook story for DataVisNitroGrid that wires up a datavis-ace Prefs module so the Perspectives UI (toolbar / hamburger menu) is visible and testable in Storybook, aligning behavior with the external DataVis demo.
Changes:
- Import and type-cast
datavis-ace’s untypedPrefsconstructor to aPrefsInstanceconstructor signature. - Add a
PerspectivesGridhelper that creates a localStorage-backed prefs module, binds it to the shared view fromDataVisNitroContext, and passes it into<DataVisNitroGrid prefs={...} />. - Add a
WithPerspectivesStorybook story with documentation explaining how prefs enable the perspectives toolbar and persistence.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Deploying ui with
|
| Latest commit: |
ad4a864
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://84a4b6ce.ui-6d0.pages.dev |
| Branch Preview URL: | https://feature-datavis-perspectives.ui-6d0.pages.dev |
Address Copilot review: bind prefs to the view and prime it in a useEffect instead of inside useMemo, which can re-run under StrictMode.
Address Copilot review: clear the story's localStorage prefs key via a loader when navigator.webdriver is set, so test runners start from a clean default state while preserving persistence for manual browsing.
Address Copilot review: wrap the loader's localStorage.removeItem in try/catch so a SecurityError in restricted/embedded contexts falls back to default perspectives instead of crashing the story.
The npm audit endpoint (registry.npmjs.org/-/npm/v1/security/audits) has intermittent outages that fail CI with ERR_SOCKET_TIMEOUT even though no vulnerability exists (run #1915 failed twice on this). Detect network errors in the audit output and emit a warning instead of failing; genuine high-severity findings still fail the job.
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
Adds a
WithPerspectivesstory to the DataVis NITRO Storybook page so the perspective toolbar (the "Main Perspective" dropdown with save / reset / undo-redo history) is visible and testable — matching what https://mieweb.github.io/datavis/ shows.Details
PerspectivesGridhelper reads the shared view fromDataVisNitroContext, creates adatavis-acePrefsmodule with alocalStoragebackend, binds it viaview.setPrefs(prefs), and passes it to<DataVisNitroGrid prefs={…}>.datavis-aceis untyped JS (Prefsis built with a runtimemakeSubclasshelper), so the story casts it to an explicit constructor signature returningPrefsInstance.localStorageundermieweb-ui-storybook:datavis-prefs.Verification
pnpm typecheck,eslint, andprettierall pass.