Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client): late answers no longer vanish when only part of a thread is loaded #16437

Closedyaacovcorcos(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/16437/headopened View on GitHub

Showing 2 changed files with 60 additions and 0 deletions.

x
0 of 2 viewed, 2 left
47 additions and 0 deletionspackages/client-runtime/src/state/orchestrationV2Projection.test.tsModified
View file
@@ -275,6 +275,53 @@
expect(next?.visibleTurnItems.map((row) => row.position)).toEqual([0, 1]);
});
​
+ it.each([
+ { name: "keeps an item from a loaded run", itemRunId: runId, kept: true },
+ {
+ name: "drops an item from an unloaded run",
+ itemRunId: RunId.make("run-unloaded"),
+ kept: false,
+ },
+ ])("partial timeline: $name that arrives after a later sibling", ({ itemRunId, kept }) => {
+ // Only this run is loaded. Its later item already advanced the watermark.
+ const first = commandItem("item-first", "first", 11);
+ const later = commandItem("item-later", "later", 13);
+ const late = { ...commandItem("item-late", "late", 12), runId: itemRunId };
+ const projection = {
+ ...emptyProjection,
+ runs: [run, { ...run, id: RunId.make("run-unloaded") }],
+ turnItems: [first, later],
+ visibleTurnItems: [first, later].map((item, position) => ({
+ position,
+ visibility: "local" as const,
+ sourceThreadId: threadId,
+ sourceItemId: item.id,
+ item,
+ })),
+ };
+ const event = {
+ id: "event-late-item",