Skip to content

Commit f274498

Browse files
committed
Fix
1 parent 57d1b67 commit f274498

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

packages/core/src/js/tracing/timeToDisplayCoordinator.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ function notifyListeners(entry: SpanRegistry): void {
105105
}
106106

107107
function performCleanup(kind: DisplayKind, parentSpanId: string, entry: SpanRegistry): void {
108-
const liveCheckpoints = entry.checkpoints.size - entry.sticky.size;
109-
if (liveCheckpoints === 0 && entry.listeners.size === 0) {
108+
if (entry.sticky.size > 0) {
109+
return;
110+
}
111+
if (entry.checkpoints.size === 0 && entry.listeners.size === 0) {
110112
cancelPendingUpFlip(entry);
111113
registries[kind].delete(parentSpanId);
112114
}

packages/core/test/tracing/timeToDisplayCoordinator.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,16 @@ describe('timeToDisplayCoordinator', () => {
127127
registerCheckpoint('ttfd', SPAN_FIRST, 'b', false);
128128
expect(isAllReady('ttfd', SPAN_FIRST)).toBe(false);
129129
});
130+
131+
test('sticky-blocker survives sibling unmounts and continues to block new peers', () => {
132+
const unregisterA = registerCheckpoint('ttfd', SPAN_FIRST, 'a', false);
133+
const unregisterB = registerCheckpoint('ttfd', SPAN_FIRST, 'b', true);
134+
135+
unregisterA(); // A becomes sticky
136+
unregisterB();
137+
138+
registerCheckpoint('ttfd', SPAN_FIRST, 'c', true);
139+
flushDefer();
140+
expect(isAllReady('ttfd', SPAN_FIRST)).toBe(false);
141+
});
130142
});

0 commit comments

Comments
 (0)