perf(ui): mount row action dialogs only while open and keep unchanged live reloads (#1798)
deploy / gate (push) Failing after 13m59s
deploy / archied-image (push) Skipped
deploy / agent-image (push) Skipped
deploy / dist-zip (push) Skipped

This commit is contained in:
sam committed 2026-11-08 16:55:59 +11:00
1 parent c8a46fd9e7
commit 64bb195700
6 files changed
+20 -13

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
import { ref } from "vue"; import { ref } from "vue";
import { api } from "@/lib/api"; import { api } from "@/lib/api";
import { keepRows } from "@/lib/keep-unchanged";
import { useLiveResource } from "@/stores/session"; import { useLiveResource } from "@/stores/session";
import { loadEventTypes } from "./event-type-state"; import { loadEventTypes } from "./event-type-state";
@@ -68,7 +69,7 @@ export async function load(): Promise<void> {
const res = await api.captures<CapturesResponse>(LIST_LIMIT); const res = await api.captures<CapturesResponse>(LIST_LIMIT);
if (current !== generation) return; if (current !== generation) return;
enabled.value = res.enabled !== false; enabled.value = res.enabled !== false;
captures.value = res.captures || []; captures.value = keepRows(captures.value, res.captures || []);
error.value = null; error.value = null;
} catch (err) { } catch (err) {
if (current !== generation) return; if (current !== generation) return;
+5 -3
View File
@@ -270,6 +270,8 @@ function onConfirmationOpen(open: boolean) {
<template> <template>
<div class="flex flex-col items-end gap-1"> <div class="flex flex-col items-end gap-1">
<!-- The dialogs below mount only while open: a board holds hundreds of rows
and each would otherwise carry three idle dialog trees. -->
<Alert <Alert
v-if="error" v-if="error"
variant="destructive" variant="destructive"
@@ -332,7 +334,7 @@ function onConfirmationOpen(open: boolean) {
</MoreMenu></span> </MoreMenu></span>
</div> </div>
<Dialog :open="rereviewOpen" @update:open="onRereviewOpen"> <Dialog v-if="rereviewOpen" :open="rereviewOpen" @update:open="onRereviewOpen">
<DialogContent class="sm:max-w-lg"> <DialogContent class="sm:max-w-lg">
<DialogHeader> <DialogHeader>
<DialogTitle>Re-review this pull request?</DialogTitle> <DialogTitle>Re-review this pull request?</DialogTitle>
@@ -366,7 +368,7 @@ function onConfirmationOpen(open: boolean) {
preparation reads it. Preselecting the task's persisted mode keeps a preparation reads it. Preselecting the task's persisted mode keeps a
remediation retry continuing its branch. remediation retry continuing its branch.
--> -->
<Dialog :open="retryOpen" @update:open="onRetryOpen"> <Dialog v-if="retryOpen" :open="retryOpen" @update:open="onRetryOpen">
<DialogContent class="sm:max-w-lg"> <DialogContent class="sm:max-w-lg">
<DialogHeader> <DialogHeader>
<DialogTitle>Retry this task?</DialogTitle> <DialogTitle>Retry this task?</DialogTitle>
@@ -411,7 +413,7 @@ function onConfirmationOpen(open: boolean) {
</DialogContent> </DialogContent>
</Dialog> </Dialog>
<AlertDialog :open="confirming !== null" @update:open="onConfirmationOpen"> <AlertDialog v-if="confirming !== null" :open="confirming !== null" @update:open="onConfirmationOpen">
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>{{ confirmLabel }} this task?</AlertDialogTitle> <AlertDialogTitle>{{ confirmLabel }} this task?</AlertDialogTitle>
+5 -4
View File
@@ -25,6 +25,7 @@ import {
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { api, classifyActionError, type ActionErrorKind } from "@/lib/api"; import { api, classifyActionError, type ActionErrorKind } from "@/lib/api";
import { keepValue } from "@/lib/keep-unchanged";
import { actionFor } from "@/lib/task-meta"; import { actionFor } from "@/lib/task-meta";
import { useLiveResource } from "@/stores/session"; import { useLiveResource } from "@/stores/session";
@@ -194,7 +195,7 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
Promise.race([fetcher(), timeout]) Promise.race([fetcher(), timeout])
.then((res) => { .then((res) => {
if (loadGenerations.get(cacheKey) !== current) return; if (loadGenerations.get(cacheKey) !== current) return;
cache.value = new Map(cache.value).set(cacheKey, res); cache.value = new Map(cache.value).set(cacheKey, keepValue(cache.value.get(cacheKey), res));
}) })
.catch(() => { .catch(() => {
if (loadGenerations.get(cacheKey) !== current) return; if (loadGenerations.get(cacheKey) !== current) return;
@@ -208,7 +209,7 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
api api
.tasks<TaskRecord[]>() .tasks<TaskRecord[]>()
.then((res) => { .then((res) => {
taskList.value = res; taskList.value = keepValue(taskList.value, res);
}) })
.catch(() => { .catch(() => {
// Keep the last known list: a failed refresh must not flash the // Keep the last known list: a failed refresh must not flash the
@@ -223,7 +224,7 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
api api
.taskAttempts<AttemptsState>(String(id.value)) .taskAttempts<AttemptsState>(String(id.value))
.then((res) => { .then((res) => {
attempts.value = res; attempts.value = keepValue(attempts.value, res);
}) })
.catch((err) => { .catch((err) => {
if ((err as { status?: number })?.status === 404) missing.value = true; if ((err as { status?: number })?.status === 404) missing.value = true;
@@ -237,7 +238,7 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
api api
.task<TaskEvent[]>(String(id.value)) .task<TaskEvent[]>(String(id.value))
.then((res) => { .then((res) => {
events.value = res || []; events.value = keepValue(events.value, res || []);
}) })
.catch(() => { .catch(() => {
events.value = null; events.value = null;
+2 -1
View File
@@ -20,6 +20,7 @@ import {
} from "@/components/ui/trace"; } from "@/components/ui/trace";
import ChatMarkdown from "@/chat/ChatMarkdown.vue"; import ChatMarkdown from "@/chat/ChatMarkdown.vue";
import { api } from "@/lib/api"; import { api } from "@/lib/api";
import { keepValue } from "@/lib/keep-unchanged";
import { useLiveResource } from "@/stores/session"; import { useLiveResource } from "@/stores/session";
import { duration } from "@/tasks/timeline-event"; import { duration } from "@/tasks/timeline-event";
import type { TaskEvent } from "@/tasks/task-run"; import type { TaskEvent } from "@/tasks/task-run";
@@ -49,7 +50,7 @@ async function load(): Promise<void> {
try { try {
const view = await api.taskTranscript<{ entries?: TaskEvent[] }>(String(props.taskId), { attempt: props.attempt }); const view = await api.taskTranscript<{ entries?: TaskEvent[] }>(String(props.taskId), { attempt: props.attempt });
if (current !== generation) return; if (current !== generation) return;
events.value = view.entries ?? []; events.value = keepValue(events.value, view.entries ?? []);
failed.value = false; failed.value = false;
} catch { } catch {
if (current === generation) failed.value = true; if (current === generation) failed.value = true;
+2 -1
View File
@@ -13,6 +13,7 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner"; import { Spinner } from "@/components/ui/spinner";
import { api } from "@/lib/api"; import { api } from "@/lib/api";
import { keepRows } from "@/lib/keep-unchanged";
import { useLiveResource } from "@/stores/session"; import { useLiveResource } from "@/stores/session";
import { statusKind, statusLabel, takesRepository, type Binding } from "@/bindings/binding-draft"; import { statusKind, statusLabel, takesRepository, type Binding } from "@/bindings/binding-draft";
import type { Capture } from "@/captures/state"; import type { Capture } from "@/captures/state";
@@ -82,7 +83,7 @@ const status = ref(props.binding?.status ?? "");
async function loadCaptures(): Promise<void> { async function loadCaptures(): Promise<void> {
const listed = await api.captures<{ captures?: Capture[] }>(100).catch(() => null); const listed = await api.captures<{ captures?: Capture[] }>(100).catch(() => null);
captures.value = listed?.captures ?? []; captures.value = keepRows(captures.value, listed?.captures ?? []);
} }
async function loadAll(): Promise<void> { async function loadAll(): Promise<void> {
+4 -3
View File
@@ -3,6 +3,7 @@ import { Item, ItemGroup } from "@/components/ui/item";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { computed, onUnmounted, ref, watch } from "vue"; import { computed, onUnmounted, ref, watch } from "vue";
import { api } from "@/lib/api"; import { api } from "@/lib/api";
import { keepValue } from "@/lib/keep-unchanged";
import { useLiveResource } from "@/stores/session"; import { useLiveResource } from "@/stores/session";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import ChangeCapture from "@/tasks/ChangeCapture.vue"; import ChangeCapture from "@/tasks/ChangeCapture.vue";
@@ -42,10 +43,10 @@ async function refresh(): Promise<void> {
if (current !== generation) return; if (current !== generation) return;
const [activity, capture, log] = results; const [activity, capture, log] = results;
activityError.value = activity.status === "rejected" ? "Could not load step activity" : ""; activityError.value = activity.status === "rejected" ? "Could not load step activity" : "";
if (activity.status === "fulfilled") events.value = activity.value.events ?? []; if (activity.status === "fulfilled") events.value = keepValue(events.value, activity.value.events ?? []);
changesError.value = capture.status === "rejected" ? "Could not load captured changes" : ""; changesError.value = capture.status === "rejected" ? "Could not load captured changes" : "";
if (capture.status === "fulfilled") changes.value = capture.value; if (capture.status === "fulfilled") changes.value = keepValue(changes.value, capture.value);
logs.value = log.status === "fulfilled" ? log.value : null; logs.value = log.status === "fulfilled" ? keepValue(logs.value, log.value) : null;
loading = false; loading = false;
if (queued) { queued = false; void refresh(); } if (queued) { queued = false; void refresh(); }
} }