perf(hydration): implement cache-first site discovery and SWR event loading

- Refactored lookup_site_domain_v3 to be cache-first, unblocking root layout.
- Implemented Stale-While-Revalidate (SWR) pattern for load_ae_obj_id__event.
- Added global hydration overlay and loading spinner to +layout.svelte.
- Updated site domain whitelist to persist critical account/styling metadata in Dexie.
- Refactored root load function to return immediately if cached site data is found.
This commit is contained in:
Scott Idem
2026-01-26 16:41:14 -05:00
parent c95b866969
commit 359eb9cf3f
5 changed files with 157 additions and 67 deletions

View File

@@ -718,6 +718,14 @@
}
});
let is_hydrating = $state(true);
$effect(() => {
if (browser && $ae_loc?.account_id) {
// Give a tiny delay to ensure everything is rendered
setTimeout(() => is_hydrating = false, 150);
}
});
$effect(() => {
if (browser) {
const interval = setInterval(() => {
@@ -1325,6 +1333,18 @@ email = ${$ae_loc?.email}
<!-- The children will contain top level (directly under body tag) div tag(s) or similar. Modal and AppShell should also be set there. The AppShell gives access to a header, footer, AppBar (usually under header), -->
{@render children?.()}
{#if is_hydrating}
<div class="fixed inset-0 z-[99] flex flex-col items-center justify-center bg-surface-50/50 dark:bg-surface-900/50 backdrop-blur-[2px] transition-all duration-500">
<div class="preset-filled-surface-100-900 p-6 rounded-xl shadow-2xl border border-surface-500/20 flex flex-col items-center gap-4">
<span class="fas fa-cog fa-spin text-4xl text-primary-500"></span>
<div class="text-center">
<div class="text-lg font-bold">Hydrating Aether...</div>
<div class="text-xs opacity-60">Synchronizing local cache</div>
</div>
</div>
</div>
{/if}
{:else if browser || flag_reload}
<div
class="flex flex-col items-center justify-center max-w-lg mx-auto space-y-6 border border-red-500 rounded-lg p-4 bg-green-50 dark:bg-green-900 m-8"