fix: prevent "No crumbs yet" flash on page refresh

Add notesLoaded store flag set after IDB read completes. Gate the empty
state message behind it so it only shows once we know the store is empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Frederic Cabassut
2026-03-06 23:12:36 +01:00
co-authored by Claude Opus 4.6
parent d9c9663af2
commit d6f668b31d
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ import { extractTags } from '$lib/utils/tags.js';
export const notes = writable<Note[]>([]);
export const currentFilter = writable<NoteFilter>('all');
export const selectedTag = writable<string | null>(null);
export const notesLoaded = writable(false);
export const filteredNotes = derived(
[notes, selectedTag, currentFilter],
@@ -49,8 +50,9 @@ export async function loadNotes(filter: NoteFilter = 'all') {
const cached = await getAllNotes();
if (cached.length > 0) {
notes.set(cached);
currentFilter.set(filter);
}
currentFilter.set(filter);
notesLoaded.set(true);
// Then fetch from server in the background
try {