Migrate to React 19, Typescript, Vite, and Vitest#5
Open
mrecachinas wants to merge 8 commits intospectriclabs:mainfrom
Open
Migrate to React 19, Typescript, Vite, and Vitest#5mrecachinas wants to merge 8 commits intospectriclabs:mainfrom
mrecachinas wants to merge 8 commits intospectriclabs:mainfrom
Conversation
- Convert all class components to functional components with hooks - Replace legacy Context API (childContextTypes) with React.createContext + usePlot hook - Replace UNSAFE_componentWillReceiveProps with useEffect + useRef previous-props pattern - Replace Layer base class inheritance with shared usePlot() hook - Convert JavaScript to TypeScript with sigplot type declarations - Replace webpack with Vite (library mode, ESM + UMD output) - Replace Jest + Enzyme with Vitest + @testing-library/react - Add vitest-canvas-mock with measureText fix for sigplot compatibility - Update peer dependencies to React ^19.0.0 - Export SigPlotContext and usePlot hook for custom layer development - Bump version to 1.0.0 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run 'npm run dev' and open http://localhost:5173 to see the example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add Plot cleanup on unmount (SigPlot.tsx) — removes injected canvases and nulls refs/state to prevent memory leaks and Strict Mode issues - Fix multi-prop change drop in all layer update effects — use independent if blocks instead of if/else if chain so simultaneous prop changes are all processed - Fix WPipeLayer: add wsurl default, remove non-null assertions, remove unused overrides prop from interface - Guard change_settings calls against undefined props in all layers - Fix PipeLayer initial mount to handle ArrayBuffer data (not just arrays) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- BlueLayer: 5 tests covering mount, reload, headermod, no-op, unmount - Plugin: 2 tests covering add on mount, remove on unmount - src/ coverage now at ~80% (all public API components 94-100%) - Install @vitest/coverage-v8 for coverage reporting Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mock overlay_href in all HrefLayer and SigPlot HrefLayer tests to prevent sigplot from firing real XHR requests that fail in jsdom with a DataView bounds error when parsing bluefile responses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add --no-warnings to vitest fork execArgv to suppress the harmless Node 25 localstorage-file warning emitted by jsdom workers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This PR migrates React-SigPlot to React 19, Typescript, Vite, and Vitest. This also converts all legacy classes to functional components, while maintaining the same API with one exception.
One breaking change:
Layerwas exported in the old version as an abstract base class users could extend. Since we replaced class inheritance with hooks, there's no Layer class anymore. Anyone who was doingimport { Layer } from 'react-sigplot'and extending it would break.The new equivalents are
usePlot()andSigPlotContext-- which are more idiomatic for custom layers in React 19. Since this is a major version bump (0.x → 1.0), the Layer removal is acceptable, but we should document it.