Uh oh!
There was an error while loading. Please reload this page.
improvement(react): replace unnecessary useEffect patterns with better React primitives - #3675
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Fixes several interaction edge cases: chat input now resizes on change and focuses via Improves menu UX/accessibility by preventing color picker focus from stealing input, adding max-height constraints to dropdown content, and hardening Written by Cursor Bugbot for commit 4860ff8. Configure here. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Greptile SummaryThis PR replaces ~25 Key observations:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[useEffect Pattern] --> B{Pattern Type}
B -->|Derived from props/params| C[Lazy initializer / useMemo / inline]
B -->|Sync ref with state| D[updateState / updateIsMuted callbacks]
B -->|Prop-to-state sync| E[Render-time state adjustment\nprevValue sentinel]
B -->|Event-driven reset| F[useCallback reset + onOpenChange]
B -->|Focus management| G[requestAnimationFrame /\nonOpenAutoFocus prop]
B -->|Track loaded-once flag| H[useRef mutation in render body]
C -->|login, signup, reset-password,\ncombobox| C1[✅ Clean: runs at correct time,\nno extra renders]
D -->|voice-interface| D1[✅ Ref always in sync;\nall setState call sites updated]
E -->|date-picker, time-picker| E1[✅ React-recommended pattern;\nbatched state updates]
F -->|popover, add-documents-modal,\nhelp-modal| F1[⚠️ open === false → !open\nfires on undefined too]
G -->|chat/input, create-workspace-modal| G1[⚠️ adjustTextareaHeight runs\nbefore DOM update]
H -->|permissions-table| H1[⚠️ Concurrent mode: discarded\nrenders can set ref prematurely]
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Mar 19, 2026
@cursor review |
waleedlatif1
commented
Mar 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Modals (create-workspace, rename-document, edit-knowledge-base): restore useEffect watching `open` prop for form reset on programmatic open, since Radix onOpenChange doesn't fire for parent-driven prop changes - Popover: add useEffect watching `open` for programmatic close reset - Chat scroll: restore useEffect watching `isStreamingResponse` so the 1s suppression timer starts when streaming begins, not before the fetch - Credentials manager: revert render-time pattern to useEffect for initial sync from cached React Query data (useRef captures initial value, making the !== check always false on mount)
waleedlatif1
commented
Mar 19, 2026
@cursor review |
waleedlatif1
commented
Mar 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…reset - Help modal: restore useEffect watching `open` for form reset on programmatic open (same Radix onOpenChange pattern as other modals) - Invite modal: restore useEffect watching `open` to clear error on programmatic open - Combobox: restore useEffect to reset highlightedIndex when filtered options shrink (prevents stale index from reappearing when options grow) - Remove no-op handleOpenChange wrappers in rename-document and edit-knowledge-base modals (now pure pass-throughs after useEffect fix)
waleedlatif1
commented
Mar 19, 2026
waleedlatif1
commented
Mar 19, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ove no-op wrapper in create-workspace-modal - ColorGrid: replaced setTimeout with requestAnimationFrame for initial focus to wait for submenu paint completion - create-workspace-modal: removed handleOpenChange pass-through wrapper, use onOpenChange directly
waleedlatif1
commented
Mar 19, 2026
waleedlatif1
commented
Mar 19, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
… refetch The useEffect that sets previewMode should only run when selectedFileId changes, not when files array reference changes from React Query refetch. Restores the filesRef pattern to read latest files without triggering the effect — prevents overriding user's manual mode selection.
…, fix combobox dep array - add-documents-modal: handleOpenChange(true) is dead code in Radix controlled mode — restored useEffect watching open for reset-on-open - combobox: depend on filteredOptions array (not .length) so highlight resets when items change even with same count
waleedlatif1
commented
Mar 19, 2026
Addressing review concerns (4860ff8)1. |
waleedlatif1
commented
Mar 19, 2026
@cursor review |
waleedlatif1
commented
Mar 19, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

Summary
Type of Change
Testing
Tested manually. TypeScript passes with 0 errors. Lint passes clean.
Checklist