fix(web): limit workbench realtime gap hydration (#1928)

This commit is contained in:
Lyon
2026-06-22 23:42:54 +08:00
committed by GitHub
parent 7e26cf8e28
commit 8f6886943b
@@ -1232,6 +1232,7 @@ function nonBlockingProjection(projection: ProjectionDiagnostic | null): Project
}
function scheduleRealtimeGapHydration(reason: string): void {
if (!shouldHydrateRealtimeGap(reason)) return;
if (typeof window === "undefined") {
void hydrateRealtimeGap(reason);
return;
@@ -1243,6 +1244,12 @@ function nonBlockingProjection(projection: ProjectionDiagnostic | null): Project
}, 200);
}
function shouldHydrateRealtimeGap(reason: string): boolean {
if (reason.endsWith(":open")) return false;
if (reason.endsWith(":error") || reason === "visibility") return Boolean(activeTurnGapTraceId());
return true;
}
async function hydrateRealtimeGap(reason: string): Promise<void> {
if (shouldSkipActiveTurnRestGap(reason)) {
scheduleActiveTurnGapRefresh(reason);