Skip to content

fix(web): drafts survive the composer leaving the screen; the thread stays at its newest message - #536

Merged
setkyar merged 1 commit into
mainfrom
fix/composer-draft-and-pin
Dec 3, 2026
Merged

setkyar merged 1 commit into
mainfrom
fix/composer-draft-and-pin

Conversation

@setkyar

@setkyar setkyar commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

What

  • Drafts are kept per conversation. Unsent text was component state, so it was lost whenever the composer was rebuilt: on switching chats and whenever it was replaced for a moment. It now lives in an in-memory store keyed by workspace and conversation, and is forgotten when the message is sent. Nothing is written to browser storage.
  • The composer no longer blinks out. useComposerAccess fell back to "loading" each time the thread's customer id changed under it, which swapped the composer for a placeholder. A decision already made for the thread on screen now stands while it is looked up again. The first decision for a thread still waits for data.
  • The newest message stays visible. The size observer added in fix(web): keep the thread at its newest message when the message area changes height #535 attached only if the scroll container existed when the first messages arrived. On a cold load it often did not. The container is now observed whenever it mounts.

Testing

  • New unit test for the draft store; existing composer-access and bottom-pin tests pass.
  • In a local app with a mock channel account: a draft typed in one conversation is still there after visiting another and coming back; the other conversation's box is empty; both open at the bottom.
  • Typecheck and lint clean.

…stays at its newest message

Three things an operator hit while typing:

- Unsent text was lost whenever the composer was rebuilt: on switching
  chats, and when it was replaced for a moment. Drafts are now kept per
  conversation, in memory.
- The composer was replaced by a placeholder each time the thread's access
  was looked up again under a changed customer id. A decision already made
  for the thread on screen now stands while it is re-checked.
- The message area's size was only observed if its element existed when the
  first messages did. On a cold load it often did not, so the thread stayed
  short of its newest message once the bar above the composer appeared. The
  element is now observed whenever it mounts.
@setkyar
setkyar merged commit 55bb5dc into main Dec 3, 2026
9 checks passed
@setkyar
setkyar deleted the fix/composer-draft-and-pin branch December 3, 2026 16:00
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