From b196e7782ecf49feea8b9c2ae9494ae42c093ec3 Mon Sep 17 00:00:00 2001 From: Till JS Date: Tue, 14 Apr 2026 14:41:27 +0200 Subject: [PATCH] perf(web): idle-defer non-critical (app) init + lazy-load modals Homepage/workbench TTI was dominated by the layout synchronously booting event-bridge, streak tracker, LLM queue, memoro watcher, dashboard store, shared-uload and reminder scheduler before first paint, plus statically importing 7 modals/toasts/banners that are rarely-to-never visible on initial render. - Keep critical path inline: local-store init (manaStore/tag/link), unified sync engine + billing, guest-mode setup. - Move side-effect streams, projection workers and telemetry to requestIdleCallback (with setTimeout fallback). - Dynamically import KeyboardShortcutsModal, OnboardingWizard, GuestWelcomeModal, SessionWarning, EncryptionIntroBanner, SuggestionToast, NudgeToast. Modals fetch on first demand; toasts mount after idle so their transitive deps (automationsStore, day-snapshot projection, streaks, crypto gate) don't land in the initial chunk. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../apps/web/src/routes/(app)/+layout.svelte | 211 +++++++++++++----- 1 file changed, 151 insertions(+), 60 deletions(-) diff --git a/apps/mana/apps/web/src/routes/(app)/+layout.svelte b/apps/mana/apps/web/src/routes/(app)/+layout.svelte index c4cc1fefe..4714f881d 100644 --- a/apps/mana/apps/web/src/routes/(app)/+layout.svelte +++ b/apps/mana/apps/web/src/routes/(app)/+layout.svelte @@ -1,7 +1,7 @@