Skip to content

Commit b8d786d

Browse files
committed
fix: restore sidebar summary writes in writeThreadState
The PR inadvertently removed the block in writeThreadState that builds and writes SidebarThreadSummary entries to sidebarThreadSummaryById. This meant newly created threads and event-driven updates (message-sent, archived, session-set, etc.) would never populate/update the sidebar summary, causing threads to be invisible or stale in the sidebar until a separate thread-upserted shell event arrived. Restore the conditional write with the same equality-check optimization that was already in place before.
1 parent 0bb7044 commit b8d786d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

apps/web/src/store.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ function writeThreadState(
519519
const nextTurnState = toThreadTurnState(nextThread);
520520
const previousShell = state.threadShellById[nextThread.id];
521521
const previousTurnState = state.threadTurnStateById[nextThread.id];
522+
const previousSummary = state.sidebarThreadSummaryById[nextThread.id];
523+
const nextSummary = buildSidebarThreadSummary(nextThread);
522524

523525
let nextState = state;
524526

@@ -652,6 +654,16 @@ function writeThreadState(
652654
};
653655
}
654656

657+
if (!sidebarThreadSummariesEqual(previousSummary, nextSummary)) {
658+
nextState = {
659+
...nextState,
660+
sidebarThreadSummaryById: {
661+
...nextState.sidebarThreadSummaryById,
662+
[nextThread.id]: nextSummary,
663+
},
664+
};
665+
}
666+
655667
return nextState;
656668
}
657669

@@ -718,7 +730,9 @@ function writeThreadShellState(
718730
};
719731
}
720732

721-
if (!threadSessionsEqual(state.threadSessionById[nextThread.shell.id] ?? null, nextThread.session)) {
733+
if (
734+
!threadSessionsEqual(state.threadSessionById[nextThread.shell.id] ?? null, nextThread.session)
735+
) {
722736
nextState = {
723737
...nextState,
724738
threadSessionById: {

0 commit comments

Comments
 (0)