Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <nico.wiedemann@gmail.com>"]
repository = "https://github.com/EarMaster/stashpad"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 15 additions & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 22 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -63,6 +64,21 @@ async function primeStashes(): Promise<void> {
}
}

/**
* 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<void> {
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.
Expand Down Expand Up @@ -95,7 +111,11 @@ async function initApp(): Promise<void> {
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) {
Expand Down
Loading