Address React Doctor findings and simplify plotting hooks#1
Conversation
✅ Deploy Preview for abdu-fe-plot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@copilot review the changes and fix the pipeline |
There was a problem hiding this comment.
Pull request overview
Refactors the plotting app to address React Doctor findings by simplifying hook state management, improving CSV worker parsing responsiveness, and cleaning up a few UI/accessibility items while aiming to keep behavior stable.
Changes:
- Refactored
useDataStreamto a clearerstatus + error + progressmodel and keptisLoadingderived from status. - Simplified
usePlotWindowstate shape (grouped playback-related fields) while keeping interval/increment/threshold independent. - Reworked the CSV worker to avoid
awaitin tight loops, preserving cooperative yielding and batching behavior; plus assorted UI token/export cleanups and a stable slider thumb key.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/workers/csvParser.worker.ts | Refactors incremental parsing into promise-chained chunk/batch processing with explicit yielding. |
| src/hooks/usePlotWindow.ts | Consolidates playback state and wraps setters with stable callbacks. |
| src/hooks/useDataStream.ts | Replaces boolean loading state with a small status state and derives isLoading. |
| src/components/ui/slider.tsx | Stabilizes thumb keys per slider instance via useId() prefix. |
| src/components/ui/card.tsx | Removes unused Card subcomponents/exports to reduce API surface. |
| src/components/ui/button.tsx | Stops exporting buttonVariants from the shared button component. |
| src/components/PlotControls.tsx | Minor tooltip tone adjustment (bg-zinc-950). |
| src/components/FileSelector.tsx | Switches to a real button that programmatically opens the file picker (keyboard-friendly). |
| src/components/DataPlot.tsx | Aligns styling with design tokens (bg-card, border-border, text-muted-foreground). |
| src/App.tsx | Adjusts heading weight from font-bold to font-semibold. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/abdusabri/high-performance-csv-plotter/sessions/46a75120-c496-437a-8758-235ea93a7283 Co-authored-by: abdusabri <25670682+abdusabri@users.noreply.github.com>
Fixed the pipeline by applying the required Prettier formatting in No UI behavior or visual output changed in this fix, so there is no UI screenshot to provide. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary
This PR refactors the plotting app to address React Doctor findings while keeping the codebase readable and behaviorally stable. The main focus was improving hook state management, tightening worker parsing behavior, and cleaning up a handful of UI/accessibility issues.
What changed
useDataStreamby removing the extrauseTransition-based state model and keeping a clearerstatus + error + progressshape.usePlotWindowwithoutuseReducer, using a small grouped playback state only where fields are actually coupled.awaitinside loops while preserving cooperative yielding during large-file parsing.React Doctor status
99/100no-array-index-as-keyin the shared sliderWhy 99 instead of 100
React Doctor prefers avoiding index keys, but for the Radix slider this is a better tradeoff:
So the remaining point is an intentional exception to the heuristic.