diff --git a/CHANGELOG.md b/CHANGELOG.md index a267d22..ac27a1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,13 @@ popover, not for the person who wrote the commit. ## [Unreleased] +## [1.11.2] - 2026-10-24 + +### Fixed +- **Stashpad opens on the context you last used, without showing the default one first.** At + startup the splash screen gave way before your last context had been restored, so the default + context flashed up for a moment and was then replaced by the right one + ## [1.11.1] - 2026-10-24 ### Fixed diff --git a/package.json b/package.json index d1de715..40974c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stashpad", - "version": "1.11.1", + "version": "1.11.2", "description": "The staging area for your AI context.", "author": { "name": "Nico Wiedemann", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a190d6b..e413a96 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -5557,7 +5557,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stashpad" -version = "1.11.1" +version = "1.11.2" dependencies = [ "active-win-pos-rs", "aes-gcm", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 20889e8..cab3bbb 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stashpad" -version = "1.11.1" +version = "1.11.2" description = "The staging area for your AI context." authors = ["Nico Wiedemann "] repository = "https://github.com/EarMaster/stashpad" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 472a246..1329503 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "stashpad", - "version": "1.11.1", + "version": "1.11.2", "identifier": "org.stashpad", "build": { "frontendDist": "../dist", diff --git a/src/App.svelte b/src/App.svelte index 85b6c13..a0a5a97 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -600,6 +600,21 @@ const initial = (window as Window & { __initialSettings__?: Settings }) .__initialSettings__; + const initialContexts = ( + window as Window & { __initialContexts__?: Context[] } + ).__initialContexts__; + delete (window as Window & { __initialContexts__?: Context[] }) + .__initialContexts__; + + // Both preloaded: apply them now, before the splash fades, so the first frame is + // already the context in use rather than the default one. + if (initial && initialContexts) { + contexts = initialContexts; + applySettings(initial); + delete (window as Window & { __initialSettings__?: Settings }) + .__initialSettings__; + return; + } loadContexts().then(() => { if (initial) { diff --git a/src/main.ts b/src/main.ts index a3a1ca9..c5aa9e1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,10 +25,11 @@ declare global { interface Window { __app__?: unknown; __initialSettings__?: Settings; + __initialContexts__?: Context[]; } } -import type { Settings } from "$lib/types"; +import type { Context, Settings } from "$lib/types"; /** * Loads all initial data needed for app startup in parallel. @@ -63,6 +64,21 @@ async function primeStashes(): Promise { } } +/** + * Load the contexts, so App can switch to the one in use before the splash goes. + * + * App validates the saved context against this list. Fetched after mount, it arrived + * once the splash had faded, so a launch showed the default context first and then + * jumped to the right one. + */ +async function primeContexts(): Promise { + try { + window.__initialContexts__ = await new DesktopStorageAdapter().getContexts(); + } catch (error) { + log.warn("Could not preload contexts, App will load them itself:", error); + } +} + /** * Hides the splash screen with a smooth fade-out animation. * Called after the app is fully mounted and ready. @@ -95,7 +111,11 @@ async function initApp(): Promise { installGlobalErrorReporter(); // Load initial data (settings includes locale preference) - const [{ settings, locale }] = await Promise.all([loadInitialData(), primeStashes()]); + const [{ settings, locale }] = await Promise.all([ + loadInitialData(), + primeStashes(), + primeContexts(), + ]); // Store settings on window to avoid duplicate load in App.svelte if (settings) {