Repository navigation
fix(ui): keep unsent composer drafts across restart - #165
Merged
Merged
Conversation
Store composer drafts in localStorage under the existing ace:draft scope keys and write each edit synchronously, so a browser or app restart, including a quit right after typing, keeps the draft. Live sessionStorage drafts migrate unless a durable draft already exists; the legacy copy is removed once a durable one exists. Storage failures never break editor input. Refs #77
This was referenced Oct 6, 2026
iamnbutler
marked this pull request as ready for review
October 6, 2026 22:26
This was referenced Oct 6, 2026
This was referenced Oct 15, 2026
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.
Fixes the browser-side cause of #77 (dogfooding, #5). Composer drafts were kept only in
sessionStoragewith a 500 ms debounce and an unmount flush, so a restart lost them and a quick quit could lose recent edits.useDraftnow stores editor document JSON inlocalStorageunder the existingace:draft:<scope>keys, writing synchronously on every edit. A live legacysessionStoragedraft migrates unless a durable draft already exists. The legacy entry is removed only once a durable copy exists, so clear cannot bring it back. Storage is best-effort: if it fails, the editor keeps working. Send, failed-admission, scope, and mode behavior are unchanged.Validation used real headless Chromium with a persistent profile against an isolated host running the old and changed bundles (no mocks):
bun types,bun run ci, and React Doctor (100/100) passed.Native WKWebView quit/relaunch is still pending while the macOS session is locked.
Built in Ace
Implementation, checks, commit, and this PR were done in an Ace channel. Codex coordinated and reviewed outside Ace (#9, #108) and viewed screenshots outside Ace (#51). Headless Playwright ran from Ace's shell because the native session was unavailable and Ace's browser tooling is incomplete (#50).