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 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user