diff --git a/lib/community-sync.ts b/lib/community-sync.ts index 44239e1..9bc542c 100644 --- a/lib/community-sync.ts +++ b/lib/community-sync.ts @@ -161,6 +161,7 @@ export class CommunitySync extends EventTarget { #offlineStore: OfflineStore | null = null; #saveDebounceTimer: ReturnType | null = null; #syncedDebounceTimer: ReturnType | null = null; + #initialSyncFired = false; #wsUrl: string | null = null; // ── Undo/Redo state ── @@ -292,6 +293,7 @@ export class CommunitySync extends EventTarget { this.#ws.onclose = () => { console.log(`[CommunitySync] Disconnected from ${this.#communitySlug}`); + this.#initialSyncFired = false; this.dispatchEvent(new CustomEvent("disconnected")); if (!this.#disconnectedIntentionally) { @@ -844,10 +846,12 @@ export class CommunitySync extends EventTarget { // 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. + // fire once after the burst settles. Only fires once per connection cycle. + if (this.#initialSyncFired) return; if (this.#syncedDebounceTimer) clearTimeout(this.#syncedDebounceTimer); this.#syncedDebounceTimer = setTimeout(() => { this.#syncedDebounceTimer = null; + this.#initialSyncFired = true; this.dispatchEvent(new CustomEvent("synced", { detail: { shapes } })); }, 300); } diff --git a/shared/components/rstack-identity.ts b/shared/components/rstack-identity.ts index b15e029..3619c93 100644 --- a/shared/components/rstack-identity.ts +++ b/shared/components/rstack-identity.ts @@ -711,7 +711,7 @@ export class RStackIdentity extends HTMLElement { let openSection: string | null = null; // Account completion status - let acctStatus: { email: boolean; multiDevice: boolean; socialRecovery: boolean; guardianCount: number; credentialCount: number } | null = null; + let acctStatus: { email: boolean; emailAddress?: string | null; multiDevice: boolean; socialRecovery: boolean; guardianCount: number; credentialCount: number } | null = null; // Lazy-loaded data let guardians: { id: string; name: string; email?: string; status: string }[] = []; @@ -819,10 +819,13 @@ export class RStackIdentity extends HTMLElement { `; } } + const emailDisplay = !isOpen && done && acctStatus?.emailAddress + ? `${acctStatus.emailAddress}` + : ""; return `