m4: per-view error states (board / search / graph / reminders)
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:
@@ -14,6 +14,7 @@ const router = useRouter();
|
||||
|
||||
const editing = ref<Note | null>(null);
|
||||
const quickAdd = ref<InstanceType<typeof QuickAdd> | null>(null);
|
||||
const loadError = ref("");
|
||||
|
||||
// The global `c` shortcut bumps composeTick; reopen the composer when we're
|
||||
// already on the board (a fresh navigation autofocuses it via the prop).
|
||||
@@ -118,7 +119,12 @@ const emptyState = computed(() => {
|
||||
});
|
||||
|
||||
async function reload() {
|
||||
await notes.load(currentView.value, currentLabel.value);
|
||||
loadError.value = "";
|
||||
try {
|
||||
await notes.load(currentView.value, currentLabel.value);
|
||||
} catch (e) {
|
||||
loadError.value = (e as { error?: string }).error ?? "Couldn't load your notes.";
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -169,6 +175,18 @@ async function onDrop(target: Note) {
|
||||
|
||||
<div v-if="notes.loading" class="py-24 text-center text-sm text-neutral-400">Loading…</div>
|
||||
|
||||
<div v-else-if="loadError" class="py-24 text-center">
|
||||
<h2 class="text-lg font-semibold text-neutral-700 dark:text-neutral-200">Couldn't load your notes</h2>
|
||||
<p class="mt-1 text-sm text-neutral-400">{{ loadError }}</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="reload"
|
||||
>
|
||||
Retry
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="notes.items.length === 0" class="py-24 text-center">
|
||||
<h2 class="text-lg font-semibold text-neutral-700 dark:text-neutral-200">{{ emptyState.title }}</h2>
|
||||
<p class="mt-1 text-sm text-neutral-400">{{ emptyState.subtitle }}</p>
|
||||
|
||||
Reference in New Issue
Block a user