import { defineStore } from "pinia"; import { ref } from "vue"; import { repo } from "../adapters"; export interface TitleEntry { id: string; title: string; } // Owner's {id, name} index of every non-trashed note. // // Outlived [[wiki-links]] (note 2897), which is what it was originally built for, // 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 // 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", () => { const items = ref([]); async function refresh(): Promise { items.value = await repo.notes.titles(); } return { items, refresh }; });