Skip to content

Commit 2d05306

Browse files
committed
🤖 fix: remove duplicate caught-up event in onChat subscription
The onChat handler was pushing a caught-up event after replayHistory, but replayHistory already sends caught-up at the end of emitHistoricalEvents. This resulted in two caught-up events being sent to the client. Removed the duplicate push to clean up the code.
1 parent 99759d1 commit 2d05306

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/node/orpc/router.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,11 @@ export const router = (authToken?: string) => {
370370
push(message);
371371
});
372372

373-
// 2. Replay history
373+
// 2. Replay history (sends caught-up at the end)
374374
await session.replayHistory(({ message }) => {
375375
push(message);
376376
});
377377

378-
// 3. Signal that subscription is established and history replay is complete
379-
// This allows clients to know when they can safely send messages without
380-
// missing events due to async generator setup timing
381-
push({ type: "caught-up" });
382-
383378
try {
384379
yield* iterate();
385380
} finally {

0 commit comments

Comments
 (0)