Skip to content

Address React Doctor findings and simplify plotting hooks#1

Merged
abdusabri merged 3 commits into
mainfrom
react-doctor-refactor
May 9, 2026
Merged

Address React Doctor findings and simplify plotting hooks#1
abdusabri merged 3 commits into
mainfrom
react-doctor-refactor

Conversation

@abdusabri
Copy link
Copy Markdown
Owner

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

  • Simplified useDataStream by removing the extra useTransition-based state model and keeping a clearer status + error + progress shape.
  • Simplified usePlotWindow without useReducer, using a small grouped playback state only where fields are actually coupled.
  • Refactored the CSV worker to avoid await inside loops while preserving cooperative yielding during large-file parsing.
  • Cleaned up UI issues flagged by React Doctor:
    • heading weight
    • neutral/text token usage
    • tooltip background tone
    • file picker accessibility
    • unused shared UI exports
  • Kept the slider thumb key stable by thumb position to preserve focus/drag behavior during controlled updates.

React Doctor status

  • Current score: 99/100
  • Remaining warning: no-array-index-as-key in the shared slider

Why 99 instead of 100
React Doctor prefers avoiding index keys, but for the Radix slider this is a better tradeoff:

  • keying by thumb value causes thumb remounts during drag/keyboard updates
  • stable per-thumb-position keys preserve DOM identity and accessibility behavior

So the remaining point is an intentional exception to the heuristic.

Copilot AI review requested due to automatic review settings May 9, 2026 15:29
@netlify
Copy link
Copy Markdown

netlify Bot commented May 9, 2026

Deploy Preview for abdu-fe-plot ready!

Name Link
🔨 Latest commit d9d3ae6
🔍 Latest deploy log https://app.netlify.com/projects/abdu-fe-plot/deploys/69ff56d94192d1000812c2db
😎 Deploy Preview https://deploy-preview-1--abdu-fe-plot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@abdusabri
Copy link
Copy Markdown
Owner Author

@copilot review the changes and fix the pipeline

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useDataStream to a clearer status + error + progress model and kept isLoading derived from status.
  • Simplified usePlotWindow state shape (grouped playback-related fields) while keeping interval/increment/threshold independent.
  • Reworked the CSV worker to avoid await in 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.

Comment thread src/components/FileSelector.tsx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

@copilot review the changes and fix the pipeline

Fixed the pipeline by applying the required Prettier formatting in src/components/DataPlot.tsx. Commit: 2c30fb1.

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>
@abdusabri abdusabri merged commit 08e88f3 into main May 9, 2026
5 checks passed
@abdusabri abdusabri deleted the react-doctor-refactor branch May 9, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants