From 532a7ac718b52c58d34e2a373719cbd603beef39 Mon Sep 17 00:00:00 2001 From: Nico Wiedemann Date: Sat, 24 Oct 2026 03:10:25 +0200 Subject: [PATCH 1/2] Open on the last-used context instead of flashing the default one The splash screen now waits for the stashes, but App only applied the saved context after loading the contexts, which it did after mount. The splash faded on the default context and the app jumped to the right one a moment later. main.ts now preloads the contexts alongside settings and stashes and hands them over the way it already hands over settings. App applies both together in its init effect, which runs before the splash fades, so the first frame shows the context in use. If either preload is missing, it falls back to the old load-after-mount path. The 1.11.1 changelog entry is extended rather than given a new section: 1.11.1 is bumped on develop but has not been released yet. Checked: svelte-check reports the same 35 errors as before and no new warnings, all 310 vitest tests pass, and tsc is clean for main.ts. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 5 +++-- src/App.svelte | 15 +++++++++++++++ src/main.ts | 24 ++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a267d22..9fb1013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,9 @@ popover, not for the person who wrote the commit. from Settings or the context manager rebuilt the list from nothing, so it showed "queue empty" until the stashes had been read again, which took seconds with a large queue. The list now comes back at once and refreshes quietly in the background. The same wait is gone at startup: - the splash screen stays up until your stashes are loaded, and if that early load fails the - list shows a "Loading stashes…" notice instead of claiming the queue is empty + the splash screen stays up until your stashes are loaded and the app opens straight on the + context you last used, rather than showing the default one for a moment first. If that early + load fails, the list shows a "Loading stashes…" notice instead of claiming the queue is empty ## [1.11.0] - 2026-10-11 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) { From 379dc3d9af1c36db49e0c23bf03c5136ec86bd7b Mon Sep 17 00:00:00 2001 From: Nico Wiedemann Date: Sat, 24 Oct 2026 03:13:54 +0200 Subject: [PATCH 2/2] chore: bump version to v1.11.2 Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 12 +++++++++--- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb1013..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 @@ -18,9 +25,8 @@ popover, not for the person who wrote the commit. from Settings or the context manager rebuilt the list from nothing, so it showed "queue empty" until the stashes had been read again, which took seconds with a large queue. The list now comes back at once and refreshes quietly in the background. The same wait is gone at startup: - the splash screen stays up until your stashes are loaded and the app opens straight on the - context you last used, rather than showing the default one for a moment first. If that early - load fails, the list shows a "Loading stashes…" notice instead of claiming the queue is empty + the splash screen stays up until your stashes are loaded, and if that early load fails the + list shows a "Loading stashes…" notice instead of claiming the queue is empty ## [1.11.0] - 2026-10-11 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",