diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte index 2fdc1b40..d77d10c6 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte @@ -285,7 +285,10 @@ if (browser) { console.log('Browser environment detected.'); - let message = { archive_id: $idaa_slct?.archive_id ?? null }; + // NOTE: Use data[data.account_id].slct.archive_id (from load / URL params), + // NOT $idaa_slct.archive_id (the store). The store is updated by a $effect that runs + // after this synchronous block — reading it here sends the old/null value. + let message = { archive_id: data[data.account_id]?.slct?.archive_id ?? null }; window.parent.postMessage(message, '*'); if ($ae_loc?.iframe) { diff --git a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte index f3eaae1f..b38b70b3 100644 --- a/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/bb/[post_id]/+page.svelte @@ -94,7 +94,10 @@ if (browser) { console.log('Browser environment detected.'); - let message = { post_id: $idaa_slct?.post_id ?? null }; + // NOTE: Use data[data.account_id].slct.post_id (from load / URL params), + // NOT $idaa_slct.post_id (the store). The store is updated by a $effect that runs + // after this synchronous block — reading it here sends the old/null value. + let message = { post_id: data[data.account_id]?.slct?.post_id ?? null }; window.parent.postMessage(message, '*'); if ($ae_loc?.iframe) { diff --git a/src/routes/idaa/(idaa)/recovery_meetings/[event_id]/+page.svelte b/src/routes/idaa/(idaa)/recovery_meetings/[event_id]/+page.svelte index 08cd604e..6174ac67 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/[event_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/[event_id]/+page.svelte @@ -37,7 +37,7 @@ idaa_prom } from '$lib/stores/ae_idaa_stores'; - import Event_obj_id_edit from '.././ae_idaa_comp__event_obj_id_edit.svelte'; + import Event_obj_id_edit from '.././ae_idaa_comp__event_obj_id_edit_v2.svelte'; import Event_obj_id_view from '.././ae_idaa_comp__event_obj_id_view.svelte'; import Help_tech from '$lib/app_components/e_app_help_tech.svelte'; @@ -94,7 +94,11 @@ if (browser) { console.log('Browser environment detected.'); - let message = { event_id: $idaa_slct?.event_id ?? null }; + // 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. + let message = { event_id: data[data.account_id]?.slct?.event_id ?? null }; window.parent.postMessage(message, '*'); if ($ae_loc?.iframe) { diff --git a/src/routes/idaa/+layout.svelte b/src/routes/idaa/+layout.svelte index eb976bd6..05286c7a 100644 --- a/src/routes/idaa/+layout.svelte +++ b/src/routes/idaa/+layout.svelte @@ -3,6 +3,7 @@ // *** Import Svelte specific import { browser } from '$app/environment'; + import { afterNavigate } from '$app/navigation'; // *** Import other supporting libraries // import * as icons from '@lucide/svelte'; @@ -165,6 +166,17 @@ // }); }); + // NOTE: Fires after every client-side navigation within the IDAA module. + // Scrolls the parent Novi page to show the top of the iframe so the user + // doesn't land in the middle of new content after clicking a post/meeting/archive. + // The individual detail pages also send scroll_to on load — this catches the + // cases they miss (e.g. navigating back to the list view). + afterNavigate(() => { + if ($ae_loc?.iframe) { + window.parent.postMessage({ scroll_to: 0 }, '*'); + } + }); + let iframe = $derived(data.url.searchParams.get('iframe')); $effect(() => {