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
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Only resolve npm versions published at least 7 days ago. See "Dependency cooldown" in
# the workspace AGENTS.md for why and for the override.
min-release-age=7
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ popover, not for the person who wrote the commit.

## [Unreleased]

## [1.11.1] - 2026-10-24

### Fixed
- **Your stashes no longer vanish for a few seconds when you come back from Settings.** Returning
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

## [1.11.0] - 2026-10-11

### Added
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.0",
"version": "1.11.1",
"description": "The staging area for your AI context.",
"author": {
"name": "Nico Wiedemann",
Expand Down
5 changes: 5 additions & 0 deletions src-tauri/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Only resolve crate versions published at least 7 days ago. See "Dependency cooldown" in
# the workspace AGENTS.md for why and for the override. Cargo before 1.100 ignores this
# with a warning.
[registry]
global-min-publish-age = "7 days"
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.0"
version = "1.11.1"
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.0",
"version": "1.11.1",
"identifier": "org.stashpad",
"build": {
"frontendDist": "../dist",
Expand Down
54 changes: 37 additions & 17 deletions src/lib/components/Queue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import { fade, fly } from "svelte/transition";
import { DesktopStorageAdapter } from "$lib/services/desktop-adapter";
import type { StashItem, Context, Attachment, AIConfig } from "$lib/types";
import { queueCache } from "$lib/stores/queue-cache";
import { _ } from "$lib/i18n";
import { isHexColor, extractTagsAndColors } from "$lib/utils/markdown";
import StashCard from "./StashCard.svelte";
Expand Down Expand Up @@ -56,6 +57,7 @@
Search,
X,
ChevronUp,
Loader2,
} from "lucide-svelte";
import { tooltip } from "$lib/actions/tooltip";
import {
Expand Down Expand Up @@ -119,7 +121,13 @@
contexts.find((c) => c.id === "default"),
);

let stashes = $state<StashItem[]>([]);
let stashes = $state<StashItem[]>(queueCache.stashes ?? []);
let loaded = $state(queueCache.stashes !== null);
// Every change goes through a reassignment of `stashes`, so this keeps the cache as
// current as the screen, not just as current as the last load.
$effect(() => {
if (loaded) queueCache.stashes = stashes;
});
let effectiveMode = $state<"Drag" | "Copy">("Drag");

// Flash state
Expand All @@ -132,8 +140,14 @@
let showBackToTop = $state(false);

// Separate arrays for dnd - these are the source of truth during drag
let activeStashes = $state<StashItem[]>([]);
let completedStashes = $state<StashItem[]>([]);
// Seeded here rather than by the effect that keeps them in step, so a remount's first
// frame already has its cards and the count effect below sees no empty-to-full jump.
let activeStashes = $state<StashItem[]>(
untrack(() => stashes.filter((s) => !s.completed && inContext(s))),
);
let completedStashes = $state<StashItem[]>(
untrack(() => stashes.filter((s) => s.completed && inContext(s))),
);
let draggedItemId = $state<string | null>(null);

// Confirmation state
Expand Down Expand Up @@ -728,18 +742,14 @@
showMenu = false;
}

function inContext(stash: StashItem): boolean {
return (stash.contextId || "default") === (currentContextId || "default");
}

// Sync stashes to active/completed
function syncLists() {
activeStashes = stashes.filter(
(s) =>
!s.completed &&
(s.contextId || "default") === (currentContextId || "default"),
);
completedStashes = stashes.filter(
(s) =>
s.completed &&
(s.contextId || "default") === (currentContextId || "default"),
);
activeStashes = stashes.filter((s) => !s.completed && inContext(s));
completedStashes = stashes.filter((s) => s.completed && inContext(s));
}

// Watch for context changes
Expand Down Expand Up @@ -808,9 +818,10 @@
});

async function load() {
const loaded = await adapter.loadStashes();
if (loaded) {
stashes = loaded;
const result = await adapter.loadStashes();
if (result) {
stashes = result;
loaded = true;
syncLists();
if (newStashId) {
checkNewStashVisibility();
Expand Down Expand Up @@ -1649,7 +1660,16 @@
</section>
{/if}

{#if stashes.length === 0}
{#if !loaded}
<!-- Only on a cold start: every later mount begins from queueCache. -->
<div
class="flex flex-col items-center justify-center py-10 text-muted-foreground/60"
role="status"
>
<Loader2 size={20} class="animate-spin mb-2" aria-hidden="true" />
<span class="text-sm">{$_("queue.loadingStashes")}</span>
</div>
{:else if stashes.length === 0}
<div
class="flex flex-col items-center justify-center py-10 text-muted-foreground/30 border border-dashed border-border/50 rounded-lg"
>
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
"other": "Andere Dateien"
},
"queueEmpty": "Warteschlange ist leer",
"loadingStashes": "Stashes werden geladen…",
"backToTop": "Nach oben",
"sortOldest": "Sortieren: Älteste zuerst",
"sortNewest": "Sortieren: Neueste zuerst",
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@
"clearCompleted": "Clear completed",
"deleteAllCompleted": "Delete all completed stashes",
"queueEmpty": "Your stashpad is empty. Add something new to start!",
"loadingStashes": "Loading stashes…",
"noActiveStashes": "No active stashes.",
"noActiveStashesFound": "No active stashes found matching filters.",
"restoreOrder": "Restore manual order",
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@
"clearCompleted": "清除已完成",
"deleteAllCompleted": "删除所有已完成的暂存项",
"queueEmpty": "你的 Stashpad 还是空的。添加点新内容开始吧!",
"loadingStashes": "正在加载暂存项…",
"noActiveStashes": "没有活动的暂存项。",
"noActiveStashesFound": "没有符合筛选条件的活动暂存项。",
"restoreOrder": "恢复手动排序",
Expand Down
28 changes: 28 additions & 0 deletions src/lib/stores/queue-cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: AGPL-3.0-only

// Copyright (C) 2026 Nico Wiedemann
//
// This file is part of Stashpad.
// Stashpad is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License, version 3,
// as published by the Free Software Foundation.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Affero General Public License for more details.

import type { StashItem } from "$lib/types";

/**
* The queue as it stood when it was last on screen, kept across mounts of `Queue`.
*
* Settings and the context manager replace the main view, so returning from either
* mounts a fresh Queue, and starting that from an empty array showed "queue empty"
* until its load came back. `main.ts` fills this before the first mount, while the
* splash screen is still up, and Queue keeps it current after that; either way a mount
* starts from it and reconciles with the database in the background.
*
* Null until something has actually read the stashes, so the empty state never claims a
* queue nobody has loaded yet.
*/
export const queueCache: { stashes: StashItem[] | null } = { stashes: null };
17 changes: 16 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import { mount } from "svelte";
import "./app.css";
import App from "./App.svelte";
import { queueCache } from "$lib/stores/queue-cache";
import { setupI18n, type SupportedLocale } from "$lib/i18n";
import { DesktopStorageAdapter } from "$lib/services/desktop-adapter";
import { installGlobalErrorReporter } from "$lib/utils/error-reporting";
Expand Down Expand Up @@ -48,6 +49,20 @@ async function loadInitialData(): Promise<{ settings: Settings | null; locale: "
}
}

/**
* Load the stashes so the queue mounts with them, keeping the splash up meanwhile.
*
* Without this the splash gave way to an empty queue that filled in seconds later. A
* failure is not fatal: the queue loads for itself on mount and shows its own spinner.
*/
async function primeStashes(): Promise<void> {
try {
queueCache.stashes = await new DesktopStorageAdapter().loadStashes();
} catch (error) {
log.warn("Could not preload stashes, the queue 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 @@ -80,7 +95,7 @@ async function initApp(): Promise<void> {
installGlobalErrorReporter();

// Load initial data (settings includes locale preference)
const { settings, locale } = await loadInitialData();
const [{ settings, locale }] = await Promise.all([loadInitialData(), primeStashes()]);

// Store settings on window to avoid duplicate load in App.svelte
if (settings) {
Expand Down
Loading