Skip to content

perf(app): avoid redundant composer draft sync during streaming - #4634

Merged
reachjalil merged 1 commit into
devfrom
smooth-typing-during-streaming
Sep 8, 2026
Merged

reachjalil merged 1 commit into
devfrom
smooth-typing-during-streaming

Conversation

@reachjalil

Copy link
Copy Markdown
Member

Summary

  • Memoize composer attachment tokens using the same pattern as pasted-text tokens.
  • Previously, each composer render allocated a fresh attachment array, including when empty. That changed a Lexical SyncPlugin effect dependency and serialized the current draft before its unchanged-value bailout. Streaming parent renders could therefore repeatedly scan an untouched draft.
  • Preserve normal updates when attachments change. No custom prop comparator, deferred draft state, streaming throttle, first-token delay, or send-path changes.

Scope and dependencies

Verification

Incomplete: tests, builds, installs, runtime profiling, and environment setup were skipped at requester direction. Ready for review as explicitly requested; no runtime performance result is claimed.

  • Passed: git diff --check and git diff --check origin/dev...HEAD (exit 0).
  • Signed commit verified with git log --format="%H %G? %s" origin/dev..HEAD: signature status G.

Reviewer reproduction (not run)

  1. Open a conversation and request a long streaming Markdown response.
  2. While the response streams, type and edit a long multiline follow-up draft with no attachments. Confirm text and cursor remain intact, and queue or steer immediately after the last keystroke.
  3. Repeat with an attachment and pasted-text chip. Add/remove an attachment and confirm chip content and submission remain current.
  4. With React profiling enabled, inspect Lexical SyncPlugin while streaming without editing the draft: unchanged attachment tokens should no longer retrigger its draft-serialization effect. Confirm actual draft edits still synchronize and the first streamed token is not delayed.

Runtime assertions and a measured responsiveness comparison remain deferred.

@vercel

vercel Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 8, 2026 7:40pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 8, 2026 7:40pm UTC
openwork-diagnostics Skipped Skipped Sep 8, 2026 7:40pm UTC
openwork-landing Skipped Skipped v0 Sep 8, 2026 7:40pm UTC

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (7440f5144cae6a454bcc9ec563dcbc496678d214). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@reachjalil
reachjalil merged commit b9a3417 into dev Sep 8, 2026
27 checks passed

This branch was successfully deployed

1 active and 3 inactive deployments
Preview – openwork-app — 7440f514 Deployed Sep 8, 2026 by vercel[bot]
Preview – openwork-diagnostics — 7440f514 Deployed Sep 8, 2026 by vercel[bot]
Preview – openwork-den — 7440f514 Deployed Sep 8, 2026 by vercel[bot]
Preview – openwork-landing — 7440f514 Deployed Sep 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant