refactor: class components → function components (20 components) - #245
refactor: class components → function components (20 components)#245jdpigeon wants to merge 2 commits into
Conversation
Draft spec for the project skill that maps OMP prewalk and @smol/@slow roles onto explore-then-handoff. Skill file not written yet.
Converts all 20 remaining class components in src/renderer/components/
to function components with hooks. Conversion-only — no behavior changes,
no prop shape changes, no file moves.
Components converted:
PreviewButton, PreviewExperiment, PyodidePlotWidget, InputCollect,
InputModal, CleanSidebar, HelpSidebar, PreTestComponent,
SecondaryNav, Design, Home, Analyze, Clean, Collect, EEGExploration,
ConnectModal, SignalQualityIndicator, Viewer, StimuliDesignColumn,
CustomDesign
Key judgement conversions:
- Viewer: 7 useEffect hooks matching class lifecycle ordering
- CustomDesign: useRef for conditionParams + conditionRevision
- ConnectModal: useMemo debounces with leading:true, trailing:false
- SignalQualityIndicator: propsRef for live-PLS interval in D3 subscription
- StimuliDesignColumn: React.memo with custom compare
Also:
- Removed @babel/plugin-proposal-decorators and
@babel/plugin-proposal-class-properties (zero decorators, class
properties native everywhere)
- Added 6 test files covering the riskier conversions
- Updated vitest.config.ts and vite.config.ts to drop babel plugin blocks
c8dd973 to
2c2d03a
Compare
|
Ponytail review of PR #245 — class-to-function conversion. 10 non-cosmetic findings that need fixing before merge. Each is a silent behavior change or a latent bug. 1.
|
Converts all 20 remaining class components in
src/renderer/components/to function components with hooks. Conversion-only — no behavior changes, no prop shape changes, no file moves.What was converted:
@babel/plugin-proposal-decoratorsand@babel/plugin-proposal-class-propertiesfrom both configs andpackage.jsonKey judgement conversions:
useEffecthooks matching class lifecycle ordering; propsRef for signal-quality IPC; cancelled flag on async mountuseRefforconditionParams+conditionRevisioninstance fields (stale-scan guard)useMemowith{ leading: true, trailing: false };UNSAFE_componentWillUpdate→useEffectwith prev-availability refpropsReffor liveplottingIntervalread inside D3 subscriberReact.memowith custom compare matching the removedshouldComponentUpdateVerification:
npm run typecheck— cleannpm run lint— no new warningsnpm test— 69 tests passing (21 files)