fix: move IDAA recovery meeting page browser block into onMount

Two state_referenced_locally warnings on data prop in
recovery_meetings/[event_id]/+page.svelte: reading a $props()
rune synchronously in a top-level if (browser) block only captures
the initial value.

Move the postMessage block into onMount (browser-only by nature);
remove the now-redundant 'browser' import.
This commit is contained in:
Scott Idem
2026-03-11 15:23:59 -04:00
parent a878e4a05b
commit 5c09730991

View File

@@ -9,8 +9,7 @@
let log_lvl: number = 0;
// *** Import Svelte specific
import { onDestroy, untrack } from 'svelte';
import { browser } from '$app/environment';
import { onMount, onDestroy, untrack } from 'svelte';
// *** Import other supporting libraries
// import { Modal } from 'flowbite-svelte';
@@ -91,13 +90,11 @@
})
);
if (browser) {
console.log('Browser environment detected.');
// NOTE: Use data[data.account_id].slct.event_id (from the load function / URL params),
// NOT $idaa_slct.event_id (the store). The store is updated by a $effect that runs
// after this synchronous block — reading it here would send the old/null value and
// fail to update the parent page URL.
// NOTE: onMount runs in browser only, so no browser guard needed.
// Use data[data.account_id].slct.event_id (from the load function / URL params),
// NOT $idaa_slct.event_id (the store) — the store is set by a $effect and may not
// reflect the correct value yet at this point.
onMount(() => {
let message = { event_id: data[data.account_id]?.slct?.event_id ?? null };
window.parent.postMessage(message, '*');
@@ -107,7 +104,7 @@
);
window.parent.postMessage({ scroll_to: 0 }, '*'); // This should be in pixels
}
}
});
onDestroy(() => {
if (log_lvl) {