From a42b49dd50efb950d17798cfac7d61a49ebd52b8 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Sat, 18 Apr 2026 19:51:51 -0400 Subject: [PATCH] fix(launcher): auto-set app_mode to native when running in Electron On a fresh Electron install the events_loc persisted store has no app_mode value set, causing the native file launch path to fall through to a browser save dialog. Auto-initialise app_mode='native' in the launcher layout when is_native is detected so all three modes (default, onsite, native) continue to work correctly. Co-Authored-By: Claude Sonnet 4.6 --- .../events/[event_id]/(launcher)/+layout.svelte | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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'; + } +});