fix(loading): cursor positioning, render-phase defaultValue sync, remove unnecessary useMemo#4396
fix(loading): cursor positioning, render-phase defaultValue sync, remove unnecessary useMemo#4396waleedlatif1 merged 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Reworks Reviewed by Cursor Bugbot for commit 3cb4a15. Configure here. |
Greptile SummaryThis PR makes three focused improvements to the home chat UI: it replaces the Confidence Score: 5/5Safe to merge — changes are targeted, well-reasoned, and no new logic paths introduce regressions. No P0 or P1 findings. The render-phase derived-state pattern is the canonical React approach and initialises correctly. The cursor placement correctly uses the isEditingElsewhere guard to survive the subsequent auto-focus RAF. The useMemo removal is correct given unstable upstream references. All prior thread concerns are resolved. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Parent
participant UserInput
participant React
participant DOM
Note over UserInput: Mount
UserInput->>React: useState initialises value and prevDefaultValue
React->>DOM: Render textarea with draft text
Note over UserInput: Draft restore effect runs
UserInput->>DOM: textarea.focus()
UserInput->>DOM: textarea.setSelectionRange(len, len)
Note over UserInput: Auto-focus RAF fires
UserInput->>DOM: check activeElement
DOM-->>UserInput: activeElement is textarea
Note over UserInput: isEditingElsewhere=true, focus skipped, cursor preserved
Note over Parent: defaultValue prop changes
Parent->>UserInput: new defaultValue string
Note over UserInput: Render-phase derived state update
UserInput->>React: setPrevDefaultValue + setValue batched
React->>DOM: Re-render with new value, no stale flash
Reviews (2): Last reviewed commit: "chore(user-input): remove extraneous com..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3cb4a15. Configure here.
Summary
Type of Change
Testing
Tested manually — cursor lands at end of restored draft text, defaultValue sync correct, no regressions
Checklist