diff --git a/src/lib/components/chat/Settings/SyncStatsModal.svelte b/src/lib/components/chat/Settings/SyncStatsModal.svelte index 5adb29b629..0fcedcb1de 100644 --- a/src/lib/components/chat/Settings/SyncStatsModal.svelte +++ b/src/lib/components/chat/Settings/SyncStatsModal.svelte @@ -51,6 +51,11 @@ } }; + // Watch for modal visibility changes to notify opener + $: if (show && window.opener) { + window.opener.postMessage('loaded', '*'); + } + onMount(() => { window.addEventListener('message', handleMessage); }); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index c7bb8c5c50..25c14101c3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -835,9 +835,9 @@ loaded = true; } - // Notify opener window that the app has loaded - if (window.opener ?? false) { - window.opener.postMessage('loaded', '*'); + // Auto-show SyncStatsModal when opened with ?sync=true (from community) + if ((window.opener ?? false) && $page.url.searchParams.get('sync') === 'true') { + showSyncStatsModal = true; } return () => {