mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 00:49:40 +02:00
fix: revert guestMode $state() — caused effect_update_depth_exceeded
Making guestMode reactive with $state() triggered an infinite effect cascade: guestMode.notifications being accessed in the template created a reactive dependency that, combined with 8+ AppPages each running $effect for module loading, exceeded Svelte's effect update depth limit. Root cause: GuestMode object has reactive getters that return new references on each access. Wrapping it in $state() made every template access trigger a re-render, which triggered more effects, creating an unbounded cascade. Fix: Keep guestMode as plain variable (non-reactive). The warning about non_reactive_update is acceptable — guestMode is set once during init and its properties are accessed imperatively, not reactively. Also: - Remove debug console.logs from AppPage, +page, +layout - Keep onMount for workbench state loading (replaces $effect) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6ced238571
commit
f819b24596
3 changed files with 0 additions and 19 deletions
|
|
@ -59,15 +59,8 @@
|
|||
// ── List View (always loaded) ───────────────────────────
|
||||
let ListComponent = $state<Component | null>(null);
|
||||
let loadError = $state(false);
|
||||
let effectCount = 0;
|
||||
|
||||
$effect(() => {
|
||||
effectCount++;
|
||||
console.log(`[AppPage:${appId}] effect #${effectCount}, appEntry:`, !!appEntry);
|
||||
if (effectCount > 20) {
|
||||
console.error(`[AppPage:${appId}] INFINITE EFFECT LOOP DETECTED`);
|
||||
return;
|
||||
}
|
||||
ListComponent = null;
|
||||
loadError = false;
|
||||
if (appEntry) {
|
||||
|
|
|
|||
|
|
@ -238,21 +238,15 @@
|
|||
|
||||
// ── Auth Ready (replaces monolith onMount) ──────────────
|
||||
async function handleAuthReady() {
|
||||
console.log('[LAYOUT] handleAuthReady START');
|
||||
// Phase A: Auth-independent — guests + authenticated
|
||||
await Promise.all([
|
||||
manacoreStore.initialize(),
|
||||
tagLocalStore.initialize(),
|
||||
linkLocalStore.initialize(),
|
||||
]);
|
||||
console.log('[LAYOUT] stores initialized');
|
||||
console.log('[LAYOUT] migrating legacy DBs...');
|
||||
await migrateFromLegacyDbs();
|
||||
console.log('[LAYOUT] initSharedUload...');
|
||||
initSharedUload();
|
||||
console.log('[LAYOUT] dashboardStore init...');
|
||||
await dashboardStore.initialize();
|
||||
console.log('[LAYOUT] Phase A complete');
|
||||
|
||||
// Restore nav collapsed state
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
|
|
|
|||
|
|
@ -43,15 +43,12 @@
|
|||
|
||||
// Load persisted state once on mount (not reactive — avoids loop with persistState)
|
||||
import { onMount } from 'svelte';
|
||||
console.log('[HOME] script init');
|
||||
onMount(() => {
|
||||
console.log('[HOME] onMount');
|
||||
const s = workbenchStore.settings;
|
||||
if (s.openApps?.length) openApps = [...s.openApps];
|
||||
});
|
||||
|
||||
function persistState() {
|
||||
console.log('[HOME] persistState called');
|
||||
workbenchStore.update({
|
||||
openApps: openApps.map((a) => ({
|
||||
appId: a.appId,
|
||||
|
|
@ -64,11 +61,8 @@
|
|||
}
|
||||
|
||||
// ── Map to CarouselPage[] ───────────────────────────────
|
||||
let renderCount = 0;
|
||||
let carouselPages = $derived<CarouselPage[]>(
|
||||
openApps.map((a) => {
|
||||
renderCount++;
|
||||
if (renderCount % 100 === 0) console.log(`[HOME] carouselPages derived #${renderCount}`);
|
||||
const entry = getAppEntry(a.appId);
|
||||
return {
|
||||
id: a.appId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue