fix: clear stale busy state after session recovery
Reconcile session status after materializing recovered messages Return composer from stop to send when the server reports idle
This commit is contained in:
@@ -248,6 +248,7 @@ async function materializeSessionFromServer(
|
|||||||
store: StoreApi<DirectoryStore>,
|
store: StoreApi<DirectoryStore>,
|
||||||
options?: SessionMaterializationRequest & { isStale?: () => boolean },
|
options?: SessionMaterializationRequest & { isStale?: () => boolean },
|
||||||
) {
|
) {
|
||||||
|
const statusBeforeMaterialization = store.getState().session_status?.[sessionID]
|
||||||
syncDebug.recovery.materializing({
|
syncDebug.recovery.materializing({
|
||||||
reason: options?.reason ?? "ensure-session-messages",
|
reason: options?.reason ?? "ensure-session-messages",
|
||||||
directory,
|
directory,
|
||||||
@@ -282,11 +283,15 @@ async function materializeSessionFromServer(
|
|||||||
info: stripMessageDiffSnapshots(record.info),
|
info: stripMessageDiffSnapshots(record.info),
|
||||||
parts: record.parts ?? [],
|
parts: record.parts ?? [],
|
||||||
})),
|
})),
|
||||||
{ skipPartTypes: RECONNECT_SKIP_PARTS },
|
{ skipPartTypes: RECONNECT_SKIP_PARTS },
|
||||||
)
|
)
|
||||||
return { message: materialized.message, part: materialized.part }
|
return { message: materialized.message, part: materialized.part }
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
if (statusBeforeMaterialization && statusBeforeMaterialization.type !== "idle" && !options?.isStale?.()) {
|
||||||
|
await resyncDirectorySessionStatuses(directory, store, [sessionID], "authoritative")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Module-level refs for notification viewed check.
|
// Module-level refs for notification viewed check.
|
||||||
// Used to determine if user is currently viewing the session when a notification arrives.
|
// Used to determine if user is currently viewing the session when a notification arrives.
|
||||||
|
|||||||
Reference in New Issue
Block a user