feat: fix multiple re-renders on user-input and split the file#3768
feat: fix multiple re-renders on user-input and split the file#3768waleedlatif1 merged 2 commits intosimstudioai:stagingfrom
Conversation
PR SummaryMedium Risk Overview To reduce unnecessary re-renders and stale closures, Written by Cursor Bugbot for commit 6b105a2. This will update automatically on new commits. Configure here. |
|
@adithyaakrishna is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR splits the monolithic Key changes:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
UI["UserInput (no memo)"]
UI -->|"renders (isolated subtree)"| APE["AnimatedPlaceholderEffect\n(React.memo)\n← isolates placeholder animation\nre-renders here only"]
UI -->|"stable callbacks via filesRef"| AFL["AttachedFilesList\n(React.memo)"]
UI -->|"isDragging flag"| DO["DropOverlay\n(React.memo)"]
UI -->|"isListening + stable onToggle"| MB["MicButton\n(React.memo)"]
UI -->|"stable props + forwardRef"| PMD["PlusMenuDropdown\n(React.memo + forwardRef)"]
UI -->|"isSending + canSubmit"| SB["SendButton\n(React.memo)"]
APE -->|"useEffect: sets textarea.placeholder\nwithout re-rendering parent"| TA["<textarea> DOM node"]
subgraph "_components/index.ts (barrel)"
APE
AFL
DO
MB
PMD
SB
end
Reviews (1): Last reviewed commit: "chore: split user-input" | Re-trigger Greptile |
apps/sim/app/workspace/[workspaceId]/home/components/user-input/user-input.tsx
Show resolved
Hide resolved
e98b1cd to
6b105a2
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| if (textareaRef.current) { | ||
| textareaRef.current.placeholder = placeholder | ||
| } | ||
| }, [placeholder, textareaRef]) |
There was a problem hiding this comment.
Placeholder flickers due to useEffect instead of useLayoutEffect
Medium Severity
AnimatedPlaceholderEffect uses useEffect to imperatively set the textarea's placeholder, but the textarea renders with placeholder=''. Since useEffect fires after the browser paints, users see a brief flash of an empty placeholder on mount and whenever isInitialView toggles. Previously, placeholder was set directly as a JSX prop (synchronous, no flash). The parent component already uses useLayoutEffect for similar imperative DOM mutations on the same textarea, so switching to useLayoutEffect here would preserve the original behavior without the flicker.
Additional Locations (1)
…file (#3768) * feat: fix rerenders * chore: split user-input


Summary
Type of Change
Checklist
Screenshots/Videos
After
Screen.Recording.2026-03-26.at.12.47.08.AM.mov
Before
Screen.Recording.2026-03-26.at.12.22.02.AM.mov