fix(tui): preserve first message in new sessions (#38542)
Co-authored-by: Kit Langton <kit.langton@gmail.com> Co-authored-by: James Long <17031+jlongster@users.noreply.github.com>
This commit is contained in:
parent
360e7b412d
commit
18fccac6ff
1 changed files with 6 additions and 0 deletions
|
|
@ -298,6 +298,12 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
|
|||
case "session.created":
|
||||
result.session.invalidate(event.data.sessionID)
|
||||
void result.session.sync(event.data.sessionID)
|
||||
// Band-aid: a newly created session starts empty, so live events can be its source of truth.
|
||||
// Fetching pending inputs and projected messages separately lets promotion move an input between snapshots,
|
||||
// causing both requests to miss it and overwrite event-built state. Skip those racy initial reads until
|
||||
// hydration can load pending and projected messages atomically.
|
||||
sync.complete(`session.pending:${event.data.sessionID}`)
|
||||
sync.complete(`session.message:${event.data.sessionID}`)
|
||||
break
|
||||
case "session.deleted":
|
||||
removeSession(event.data.sessionID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue