Skip to content

Agentic UI: Preserve chat drafts when switching sites - #4596

Open
shaunandrews wants to merge 2 commits into
trunkfrom
preserve-chat-drafts
Open

Agentic UI: Preserve chat drafts when switching sites#4596
shaunandrews wants to merge 2 commits into
trunkfrom
preserve-chat-drafts

Conversation

@shaunandrews

@shaunandrews shaunandrews commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Codex was used to implement the focused draft-preservation behavior, add regression tests, run repository checks, verify the interaction in the browser across light, dark, and RTL layouts, and draft this PR description. The resulting code and behavior were reviewed during implementation.

Proposed Changes

  • Preserve unsent composer text and attachments independently for each site when switching between sites.
  • Clear a site's cached draft after it is sent, while restoring it if sending fails.
  • Keep drafts in memory only, with a small bounded cache of up to 10 non-empty site drafts. Reloading Studio intentionally starts fresh.

This PR is stacked on #4560 because that PR keeps the chat surface mounted while moving between chat and site overview; this follow-up covers switching between different sites.

Testing Instructions

  1. Sign in with agentic features enabled and open Site A's chat.
  2. Enter text and attach a file without sending.
  3. Switch to Site B and confirm its composer is empty and independent.
  4. Enter a different draft on Site B, then switch back to Site A.
  5. Confirm Site A's original text and attachment are restored.
  6. Send the draft, leave the site, and return; confirm the sent draft is no longer restored.
  7. Repeat the visual check in light and dark color schemes.
  8. Repeat in a representative RTL locale such as Hebrew with mixed-direction text containing a URL. Confirm the attachment, text, control order, alignment, wrapping, and truncation remain correct.

Automated checks:

  • npx eslint --fix on all modified TypeScript and TSX files
  • npm run typecheck
  • npm test -- apps/ui/src/ui-classic/components/session-view/composer/index.test.tsx apps/ui/src/ui-classic/components/site-workspace/index.test.tsx apps/ui/src/components/site-list/index.test.tsx
  • npm run cli:build:ui
  • git diff --check

Screenshots

LTR dark mode Hebrew RTL with a mixed-direction URL
Composer draft restored with text and an attachment in dark mode Composer draft with text and an attachment in a Hebrew RTL layout

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@shaunandrews shaunandrews changed the title Preserve chat drafts when switching sites Agentic UI: Preserve chat drafts when switching sites Aug 18, 2026
@shaunandrews
shaunandrews marked this pull request as draft August 18, 2026 18:23
Base automatically changed from improve-overview-chat-toggle to trunk August 19, 2026 13:14
@shaunandrews
shaunandrews marked this pull request as ready for review August 20, 2026 16:38
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