perf(cursor-prompt): batch streaming result updates#504
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Consolidated into #531, which combines the AI chat streaming, Cursor Prompt streaming, Raycast useAI streaming, and AI status polling performance work in one upstream PR. Closing this superseded scoped PR in favor of the consolidated replacement. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
requestAnimationFrameor a short timer fallback.useCursorPromptto force-flush on stream done/error, cancel pending repaints on close/unmount, and keep reset behavior clearing the refs used by apply/finalization.Why
Long Cursor Prompt responses previously updated visible state once per streamed chunk even though apply/finalization already read from refs. That could cause unnecessary renderer churn during large streams. Batching preserves the streaming preview while reducing visible state updates to frame cadence.
Compatibility impact
No IPC, public hook shape, or i18n changes. Apply still reads the authoritative ref, stream completion/error forces the final visible flush, and cancellation still stops in-flight requests while avoiding a hidden prompt repaint.
How tested
node --test scripts/test-cursor-prompt-stream-batching.mjs: batched path reported 1 visible result update for 500 chunks; final flush, apply-before-flush, and cancellation tests passed.node --test scripts/test-*.mjs: passed 29 tests, skipped 1 live Electron test because Electron is not launchable here.node scripts/check-i18n.mjs: exited 0; reported existing Italian locale gaps insettings.ai.whisper.vocabularyandsettings.extensions.appSearchScope.App.tsx,CameraExtension.tsx,QuickLinkManager.tsx,SnippetManager.tsx, andLiquidGlassSurface.tsx.node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run build:main: passed.node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run build:renderer: passed with Vite CJS API and stale Browserslist warnings.