From 686b289bdb092d58a48618f35537b94e6f3ca394 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Sun, 19 Apr 2026 17:48:03 -0400 Subject: [PATCH] fix(idaa): gate BB +page.ts fetch on novi_verified Without this, +page.ts fires the API call before +layout.svelte effects run, causing posts to be written to IDB after the purge. Anonymous users (novi_verified=false) now return early with no fetch. Cached verified sessions (within TTL) continue to load normally. Co-Authored-By: Claude Sonnet 4.6 --- src/routes/idaa/(idaa)/bb/+page.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/routes/idaa/(idaa)/bb/+page.ts b/src/routes/idaa/(idaa)/bb/+page.ts index 9649efda..c3a2fcab 100644 --- a/src/routes/idaa/(idaa)/bb/+page.ts +++ b/src/routes/idaa/(idaa)/bb/+page.ts @@ -4,6 +4,8 @@ console.log(`ae_idaa_bulletin_board [root] +page.ts start`); import { error } from '@sveltejs/kit'; import { browser } from '$app/environment'; +import { get } from 'svelte/store'; +import { idaa_loc } from '$lib/stores/ae_idaa_stores'; import { posts_func } from '$lib/ae_posts/ae_posts_functions'; export const load = (async ({ params, parent }) => { @@ -29,6 +31,14 @@ export const load = (async ({ params, parent }) => { } if (browser) { + // Auth gate: do not fetch or cache IDAA posts for unauthenticated users. + // +page.ts runs before +layout.svelte effects — without this check, the API call + // fires and writes to IDB before the layout's purge can run. + if (!get(idaa_loc).novi_verified) { + console.log('IDAA BB +page.ts: novi_verified=false — skipping post fetch.'); + return data; + } + const load_post_obj_li = posts_func .load_ae_obj_li__post({ api_cfg: ae_acct.api,