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 <noreply@anthropic.com>
This commit is contained in:
parent
81d8102f69
commit
3be0fb6eed
|
|
@ -180,7 +180,7 @@ export class RStackCollabOverlay extends HTMLElement {
|
||||||
if (runtime?.isInitialized) {
|
if (runtime?.isInitialized) {
|
||||||
this.#onRuntimeReady(runtime);
|
this.#onRuntimeReady(runtime);
|
||||||
} else {
|
} 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;
|
let polls = 0;
|
||||||
this.#runtimePollInterval = setInterval(() => {
|
this.#runtimePollInterval = setInterval(() => {
|
||||||
const rt = (window as any).__rspaceOfflineRuntime;
|
const rt = (window as any).__rspaceOfflineRuntime;
|
||||||
|
|
@ -188,19 +188,16 @@ export class RStackCollabOverlay extends HTMLElement {
|
||||||
clearInterval(this.#runtimePollInterval!);
|
clearInterval(this.#runtimePollInterval!);
|
||||||
this.#runtimePollInterval = null;
|
this.#runtimePollInterval = null;
|
||||||
this.#onRuntimeReady(rt);
|
this.#onRuntimeReady(rt);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// Slow down after 15s (30 polls × 500ms) to reduce overhead
|
|
||||||
polls++;
|
polls++;
|
||||||
if (polls === 30 && this.#runtimePollInterval) {
|
if (polls >= 20) {
|
||||||
clearInterval(this.#runtimePollInterval);
|
// No runtime after ~10s — standalone/demo mode
|
||||||
this.#runtimePollInterval = setInterval(() => {
|
clearInterval(this.#runtimePollInterval!);
|
||||||
const rt2 = (window as any).__rspaceOfflineRuntime;
|
this.#runtimePollInterval = null;
|
||||||
if (rt2?.isInitialized) {
|
this.#connState = 'connected';
|
||||||
clearInterval(this.#runtimePollInterval!);
|
this.#renderBadge();
|
||||||
this.#runtimePollInterval = null;
|
if (this.#panelOpen) this.#renderPanel();
|
||||||
this.#onRuntimeReady(rt2);
|
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue