fix(ui): failed task pages keep rows with an inline error; refreshes don't flash (#1745)
A failed Load more or live refresh sets moreError beside the Load more button instead of replacing the table; only a first-load failure takes the table down. The no-match empty state says search covers loaded rows when more pages exist. refreshAll keeps attempts/events (keep=true) and a failed task-list read keeps the last known list, so panels no longer flash to loading on every live update.
This commit is contained in:
2 files changed
+15
-7
No files matched your search
@@ -46,6 +46,9 @@ const router = useRouter();
|
||||
const tasks = ref<Task[] | null>(null);
|
||||
const next = ref<string | null>(null);
|
||||
const loadingMore = ref(false);
|
||||
// A failed page load keeps the rows already shown; only a first-load failure
|
||||
// takes the whole table down (error).
|
||||
const moreError = ref<string | null>(null);
|
||||
const error = ref<string | null>(null);
|
||||
const search = ref("");
|
||||
|
||||
@@ -116,10 +119,12 @@ async function load() {
|
||||
if (current !== loadGeneration) return;
|
||||
tasks.value = page.tasks;
|
||||
next.value = page.next;
|
||||
moreError.value = null;
|
||||
} catch (err) {
|
||||
if (current !== loadGeneration) return;
|
||||
error.value = String((err as Error).message || err);
|
||||
tasks.value = null;
|
||||
const message = String((err as Error).message || err);
|
||||
if (tasks.value === null) error.value = message;
|
||||
else moreError.value = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,9 +141,10 @@ async function loadMore() {
|
||||
if (current !== loadGeneration) return;
|
||||
tasks.value = [...(tasks.value ?? []), ...page.tasks];
|
||||
next.value = page.next;
|
||||
moreError.value = null;
|
||||
} catch (err) {
|
||||
if (current !== loadGeneration) return;
|
||||
error.value = String((err as Error).message || err);
|
||||
moreError.value = String((err as Error).message || err);
|
||||
} finally {
|
||||
loadingMore.value = false;
|
||||
}
|
||||
@@ -217,10 +223,11 @@ async function reveal(id: number) {
|
||||
-->
|
||||
<TaskTable :tasks="visible" :show-repo="showRepo" :show-issue="showIssue" @done="load">
|
||||
<template #state>
|
||||
<TasksState :kind="state" @clear="clearFilters" />
|
||||
<TasksState :kind="state" :detail="search.trim() && next ? 'Search covers the loaded rows only; more pages are not loaded yet.' : null" @clear="clearFilters" />
|
||||
</template>
|
||||
</TaskTable>
|
||||
<Button v-if="next" variant="outline" class="self-center" :disabled="loadingMore" @click="loadMore">Load more</Button>
|
||||
<p v-if="moreError" class="text-center text-caption text-danger" role="alert">{{ moreError }}</p>
|
||||
</template>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -211,7 +211,8 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
|
||||
taskList.value = res;
|
||||
})
|
||||
.catch(() => {
|
||||
taskList.value = null;
|
||||
// Keep the last known list: a failed refresh must not flash the
|
||||
// panels to their loading state.
|
||||
});
|
||||
}
|
||||
|
||||
@@ -295,8 +296,8 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
|
||||
function refreshAll(): void {
|
||||
dropCaches();
|
||||
loadTaskList();
|
||||
loadAttempts();
|
||||
loadEvents();
|
||||
loadAttempts(true);
|
||||
loadEvents(true);
|
||||
refreshToken.value += 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user