m4: per-view error states (board / search / graph / reminders)
CI & Build / Python lint (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 5s
CI & Build / Python tests (push) Successful in 7s
CI & Build / Build & push image (push) Successful in 27s

Each data view now catches a failed load and shows an explicit error message
with a Retry button, instead of falling through to a misleading empty state.
Pairs with the global error toast: the toast says something failed, the view
says which and offers a retry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
This commit is contained in:
2026-07-21 00:10:40 -04:00
co-authored by Claude Opus 4.8
parent d3bb091f73
commit 545f946754
4 changed files with 71 additions and 1 deletions
+17
View File
@@ -11,6 +11,7 @@ const notes = useNotesStore();
const results = ref<Note[]>([]);
const loading = ref(false);
const error = ref("");
const editing = ref<Note | null>(null);
const query = computed(() => (typeof route.query.q === "string" ? route.query.q : ""));
@@ -22,9 +23,13 @@ async function run() {
return;
}
loading.value = true;
error.value = "";
try {
const res = await api.get<{ notes: Note[] }>(`/api/notes/search?q=${encodeURIComponent(q)}`);
results.value = res.notes;
} catch (e) {
error.value = (e as { error?: string }).error ?? "Search failed.";
results.value = [];
} finally {
loading.value = false;
}
@@ -61,6 +66,18 @@ async function onNavigate(id: string) {
<div v-if="loading" class="py-20 text-center text-sm text-neutral-400">Searching</div>
<div v-else-if="error" class="py-20 text-center">
<h2 class="text-lg font-semibold text-neutral-700 dark:text-neutral-200">Couldn't search</h2>
<p class="mt-1 text-sm text-neutral-400">{{ error }}</p>
<button
type="button"
class="mt-3 rounded-md border border-neutral-300 px-3 py-1.5 text-sm hover:bg-neutral-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand dark:border-neutral-700 dark:hover:bg-neutral-800"
@click="run"
>
Retry
</button>
</div>
<div v-else-if="query && results.length === 0" class="py-20 text-center">
<h2 class="text-lg font-semibold text-neutral-700 dark:text-neutral-200">No matches</h2>
<p class="mt-1 text-sm text-neutral-400">Nothing found for "{{ query }}".</p>