From 3be0fb6eedf619f56388326d139b84ca3d568b3c Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 31 Mar 2026 09:55:23 -0700 Subject: [PATCH] fix: collab overlay stuck on 'Connecting' in demo/standalone pages The offline runtime is not created for demo space (spaceSlug==="demo"), so the collab overlay polled forever waiting for it. Now gives up after ~10s and transitions to connected state for standalone display. Co-Authored-By: Claude Opus 4.6 --- shared/components/rstack-collab-overlay.ts | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/shared/components/rstack-collab-overlay.ts b/shared/components/rstack-collab-overlay.ts index 859815e..462e826 100644 --- a/shared/components/rstack-collab-overlay.ts +++ b/shared/components/rstack-collab-overlay.ts @@ -180,7 +180,7 @@ export class RStackCollabOverlay extends HTMLElement { if (runtime?.isInitialized) { this.#onRuntimeReady(runtime); } else { - // Poll until runtime is ready (no timeout — WS connect can take 30s+) + // Poll until runtime is ready, give up after ~10s (demo/standalone pages have no runtime) let polls = 0; this.#runtimePollInterval = setInterval(() => { const rt = (window as any).__rspaceOfflineRuntime; @@ -188,19 +188,16 @@ export class RStackCollabOverlay extends HTMLElement { clearInterval(this.#runtimePollInterval!); this.#runtimePollInterval = null; this.#onRuntimeReady(rt); + return; } - // Slow down after 15s (30 polls × 500ms) to reduce overhead polls++; - if (polls === 30 && this.#runtimePollInterval) { - clearInterval(this.#runtimePollInterval); - this.#runtimePollInterval = setInterval(() => { - const rt2 = (window as any).__rspaceOfflineRuntime; - if (rt2?.isInitialized) { - clearInterval(this.#runtimePollInterval!); - this.#runtimePollInterval = null; - this.#onRuntimeReady(rt2); - } - }, 2000); + if (polls >= 20) { + // No runtime after ~10s — standalone/demo mode + clearInterval(this.#runtimePollInterval!); + this.#runtimePollInterval = null; + this.#connState = 'connected'; + this.#renderBadge(); + if (this.#panelOpen) this.#renderPanel(); } }, 500); }