@devries-cameron20 / t3code-1 / commits / 33f8c5da29
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): keep history-placed guest messages out of the footer (#30718)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Johan Vaz committed Nov 15, 2026 at 08:23 UTC 33f8c5da2996c8a187c5bf5991ce3083a020f8de
2 files changed +53 -1
apps/web/src/components/guest/guestStream.logic.test.ts
+47
@@ -184,6 +184,53 @@ describe("applyGuestStreamEvent", () => {
184 // Once placed, a later snapshot whose window no longer holds the row must not resurrect it.
185 const placed = apply([itemEvent(2, guestMessageRow("u1", waiting.id)), snapshot(3)], queued);
186 expect(placed.awaitingRowIds.size).toBe(0);
187 +
188 + const windowed = apply(
189 + [
190 + {
191 + type: "thread",
192 + item: {
193 + kind: "snapshot",
194 + snapshotSequence: 3,
195 + projection,
196 + historyCursor: "cursor-1",
197 + hasMoreHistory: true,
198 + },
199 + },
200 + ],
201 + queued,
202 + );
203 + const historyPlaced = applyGuestStreamEvent(windowed, {
204 + type: "history-page",
205 + cursor: "cursor-1",
206 + page: {
207 + snapshotSequence: 3,
208 + items: [
209 + {
210 + position: 0,
211 + visibility: "local",
212 + sourceThreadId: projection.thread.id,
213 + sourceItemId: TurnItemId.make("u1"),
214 + item: guestMessageRow("u1", waiting.id),
215 + },
216 + ],
217 + nextCursor: null,
218 + hasMoreHistory: false,
219 + },
220 + });
221 + expect(historyPlaced.awaitingRowIds.size).toBe(0);
222 + // The row is outside the reconnect's window again; the Sent bubble must not come back.
223 + const reconnected = apply(
224 + [{ type: "view", view: { ...view, messages: [sent] } }, snapshot(4)],
225 + historyPlaced,
226 + );
227 + expect(
228 + unplacedGuestMessages(
229 + reconnected.view!.messages,
230 + reconnected.projection!.visibleTurnItems,
231 + reconnected.awaitingRowIds,
232 + ),
233 + ).toEqual([]);
234 });
235 });
236
apps/web/src/components/guest/guestStream.logic.ts
+6 -1
@@ -99,14 +99,19 @@ export function applyGuestStreamEvent(
99 event: GuestStreamEvent | GuestHistoryPageLoaded,
100 ): GuestStreamState {
101 switch (event.type) {
102 - case "history-page":
102 + case "history-page": {
103 // A snapshot since the request replaced the thread and its cursor.
104 if (state.projection === null || state.historyCursor !== event.cursor) return state;
105 return {
106 ...state,
107 projection: mergeOlderHistoryIntoProjection(state.projection, event.page.items),
108 + awaitingRowIds: withoutPlaced(
109 + state.awaitingRowIds,
110 + event.page.items.map((row) => row.item),
111 + ),
112 historyCursor: event.page.hasMoreHistory ? event.page.nextCursor : null,
113 };
114 + }
115 case "view":
116 // The page follows the share it names; a view of another one means the link changed.
117 if (state.view !== null && state.view.shareId !== event.view.shareId) {