refactor(desktop): tidy composer draft persistence

- DRY the duplicated submit-restore blocks into dispatchSubmit()
- inline localStorage access (drop browserStorage indirection);
  clearPersistedComposerDraft delegates to write('')
- drop stale per-scope-stash comment in use-session-actions
This commit is contained in:
Brooklyn Nicholson
2026-06-10 23:47:32 -05:00
parent c710868fbc
commit 292192f7d7
3 changed files with 37 additions and 75 deletions
@@ -328,10 +328,8 @@ export function useSessionActions({
setYoloActive(false)
setCurrentCwd(workspaceCwdForNewSession())
setCurrentBranch('')
// Composer contents are owned by ChatBar's per-scope draft persistence:
// the scope change triggered by the session-id updates above stashes the
// departing session's attachments and restores this scope's draft.
// Clearing here would wipe the departing stash before it's saved.
// Never clear the composer here: it sits above the thread and its
// contents (text + attachments) follow the user across session changes.
setFreshDraftReady(true)
},
[activeSessionIdRef, busyRef, navigate, selectedStoredSessionIdRef]