web: the command palette finds notes written since it was first opened
Android / Build, or is the channel already serving this? (push) Successful in 3s
Android / Kotlin + Rust (APK) (push) Skipped
CI & Build / Build now, or wait for Android? (push) Successful in 4s
CI & Build / TypeScript typecheck (push) Successful in 11s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Python tests (push) Successful in 16s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / integration (push) Successful in 41s
CI & Build / Build & push image (push) Successful in 58s
Desktop (Tauri) / Clippy, tests and rustfmt (push) Successful in 3m30s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m43s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m23s
Desktop (Tauri) / Update manifest (push) Successful in 4s
Android / Build, or is the channel already serving this? (push) Successful in 3s
Android / Kotlin + Rust (APK) (push) Skipped
CI & Build / Build now, or wait for Android? (push) Successful in 4s
CI & Build / TypeScript typecheck (push) Successful in 11s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Python tests (push) Successful in 16s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / integration (push) Successful in 41s
CI & Build / Build & push image (push) Successful in 58s
Desktop (Tauri) / Clippy, tests and rustfmt (push) Successful in 3m30s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m43s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m23s
Desktop (Tauri) / Update manifest (push) Successful in 4s
The palette's note list loaded once per session behind a `loaded` flag, and the `reload()` that would have cleared it had no caller. So a note written after the first open couldn't be found by name until the page reloaded (#5165, audit B4). The list is now fetched again on every open, and the last list stays visible meanwhile. The input takes focus before the fetch, and a failed fetch keeps the old list instead of breaking the palette. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -87,9 +87,12 @@ function onKeydown(e: KeyboardEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await titles.load();
|
// Focus first: typing a command must not wait on the note list.
|
||||||
await nextTick();
|
await nextTick();
|
||||||
input.value?.focus();
|
input.value?.focus();
|
||||||
|
// A failed refresh keeps the last list rather than breaking the palette; the
|
||||||
|
// commands work either way.
|
||||||
|
titles.refresh().catch(() => {});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -13,20 +13,17 @@ export interface TitleEntry {
|
|||||||
// because the command palette lists it so someone can jump straight to a note by
|
// because the command palette lists it so someone can jump straight to a note by
|
||||||
// name. That is recall, which is what this app is for; `resolve()` went with the
|
// name. That is recall, which is what this app is for; `resolve()` went with the
|
||||||
// links.
|
// links.
|
||||||
|
//
|
||||||
|
// Fetched again every time the palette opens. It used to load once per session
|
||||||
|
// behind a `loaded` flag, with nothing ever clearing it, so a note written after
|
||||||
|
// the first open could not be found by name until a page reload (#5165). The last
|
||||||
|
// list stays in place meanwhile, so the palette never opens empty.
|
||||||
export const useTitlesStore = defineStore("titles", () => {
|
export const useTitlesStore = defineStore("titles", () => {
|
||||||
const items = ref<TitleEntry[]>([]);
|
const items = ref<TitleEntry[]>([]);
|
||||||
const loaded = ref(false);
|
|
||||||
|
|
||||||
async function load(): Promise<void> {
|
async function refresh(): Promise<void> {
|
||||||
if (loaded.value) return;
|
|
||||||
items.value = await repo.notes.titles();
|
items.value = await repo.notes.titles();
|
||||||
loaded.value = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload(): Promise<void> {
|
return { items, refresh };
|
||||||
loaded.value = false;
|
|
||||||
await load();
|
|
||||||
}
|
|
||||||
|
|
||||||
return { items, loaded, load, reload };
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user