diff --git a/src/routes/events/[event_id]/(launcher)/+layout.svelte b/src/routes/events/[event_id]/(launcher)/+layout.svelte index 05b9de19..7ac21b6a 100644 --- a/src/routes/events/[event_id]/(launcher)/+layout.svelte +++ b/src/routes/events/[event_id]/(launcher)/+layout.svelte @@ -4,7 +4,8 @@ * Root layout for the launcher area. * Ensures background sync runs globally regardless of active tab. */ -// import { ae_loc } from '$lib/stores/ae_stores'; +import { ae_loc } from '$lib/stores/ae_stores'; +import { events_loc } from '$lib/stores/ae_events_stores'; import Launcher_Background_Sync from './launcher_background_sync.svelte'; interface Props { @@ -12,6 +13,17 @@ interface Props { } let { children }: Props = $props(); + +// WHY: When running inside Electron (is_native), app_mode must be 'native' for +// the file launch path to work correctly. On a fresh install the persisted store +// has no value set, so we auto-initialise it here. This preserves the three-mode +// design (default / onsite / native) — browser sessions are unaffected because +// is_native is only ever true inside the Electron shell. +$effect(() => { + if ($ae_loc.is_native && $events_loc.launcher.app_mode !== 'native') { + $events_loc.launcher.app_mode = 'native'; + } +});