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 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-18 19:51:51 -04:00
parent 278a40c981
commit a42b49dd50

View File

@@ -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';
}
});
</script>
<!-- Background Sync Process (Invisible) -->