Repository navigation
fix(cli): yield to React after addItem to reduce input lag #6059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7c50e1d
6389b39
787465d
d5d9a78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1038,6 +1038,11 @@ export const useGeminiStream = ( | |
| }; | ||
| } | ||
|
|
||
| // Yield to let React render the user message before continuing | ||
| // with @-command processing and API call. Reduces the visual lag | ||
| // between input-box clear and the message appearing in history. | ||
| await Promise.resolve(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Review Bot] React 19.2.4 (Ink 7.0.3) schedules renders via The pre-patch code already reaches a natural The perceived lag reduction in the PR description (200–500ms → 50–100ms) is more likely explained by those subsequent I/O-bound awaits, not this line. Suggestions:
|
||
|
|
||
| // Handle @-commands (which might involve tool calls) | ||
| if (isAtCommand(trimmedQuery)) { | ||
| const atCommandResult = await handleAtCommand({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The
setImmediateyield creates a sub-millisecond window where the user could cancel (press Escape). After the yield, execution falls through tohandleAtCommand,applyVisionBridgeIfNeeded, and eventuallysendMessageStreamwithout re-checkingturnCancelledRef. While the abort signal IS propagated to all downstream calls (so the API call fails cleanly rather than succeeding with stale data), adding an early re-check is consistent with the entry guard at line 922 and avoids unnecessary downstream work.— qwen3.7-max via Qwen Code /review