Merge branch 'dev'
This commit is contained in:
commit
73c0ea9292
|
|
@ -128,6 +128,7 @@ export class CommunitySync extends EventTarget {
|
||||||
#reconnectDelay = 1000;
|
#reconnectDelay = 1000;
|
||||||
#offlineStore: OfflineStore | null = null;
|
#offlineStore: OfflineStore | null = null;
|
||||||
#saveDebounceTimer: ReturnType<typeof setTimeout> | null = null;
|
#saveDebounceTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
#syncedDebounceTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
#wsUrl: string | null = null;
|
#wsUrl: string | null = null;
|
||||||
|
|
||||||
constructor(communitySlug: string, offlineStore?: OfflineStore) {
|
constructor(communitySlug: string, offlineStore?: OfflineStore) {
|
||||||
|
|
@ -757,7 +758,14 @@ export class CommunitySync extends EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchEvent(new CustomEvent("synced", { detail: { shapes } }));
|
// Debounce the synced event — during initial sync negotiation, #applyDocToDOM()
|
||||||
|
// is called for every Automerge sync message (100+ round-trips). Debounce to
|
||||||
|
// fire once after the burst settles.
|
||||||
|
if (this.#syncedDebounceTimer) clearTimeout(this.#syncedDebounceTimer);
|
||||||
|
this.#syncedDebounceTimer = setTimeout(() => {
|
||||||
|
this.#syncedDebounceTimer = null;
|
||||||
|
this.dispatchEvent(new CustomEvent("synced", { detail: { shapes } }));
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -543,7 +543,12 @@ export class FolkRApp extends FolkShape {
|
||||||
if (pathParts.length >= 1) this.#spaceSlug = pathParts[0];
|
if (pathParts.length >= 1) this.#spaceSlug = pathParts[0];
|
||||||
}
|
}
|
||||||
const space = this.#spaceSlug || "demo";
|
const space = this.#spaceSlug || "demo";
|
||||||
const iframeUrl = `/${space}/${this.#moduleId}`;
|
// On subdomain URLs (jeff.rspace.online), the server prepends /{space}/ automatically,
|
||||||
|
// so the iframe should load /{moduleId} directly. Using /{space}/{moduleId} would
|
||||||
|
// double-prefix to /{space}/{space}/{moduleId} → 404.
|
||||||
|
const hostname = window.location.hostname;
|
||||||
|
const onSubdomain = hostname.split(".").length >= 3 && hostname.startsWith(space + ".");
|
||||||
|
const iframeUrl = onSubdomain ? `/${this.#moduleId}` : `/${space}/${this.#moduleId}`;
|
||||||
|
|
||||||
const iframe = document.createElement("iframe");
|
const iframe = document.createElement("iframe");
|
||||||
iframe.className = "rapp-iframe";
|
iframe.className = "rapp-iframe";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue