Ergebnisse: Liste und Daten beim Öffnen des Reiters neu laden, neuesten Batch wählen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
type StepRow,
|
||||
} from "$lib/api";
|
||||
|
||||
let { selected = $bindable(null) }: { selected: number | null } = $props();
|
||||
let { selected = $bindable(null), active }: { selected: number | null; active: boolean } = $props();
|
||||
|
||||
let batches = $state<BatchInfo[]>([]);
|
||||
let ranking = $state<Ranking | null>(null);
|
||||
@ -58,6 +58,20 @@
|
||||
|
||||
onMount(loadBatches);
|
||||
|
||||
// Beim Öffnen des Reiters neu laden: Während eines Laufs oder nach einem Neuladen der Oberfläche war die
|
||||
// Liste sonst veraltet. Gibt es einen neueren Batch als zuletzt gesehen, wird er gewählt.
|
||||
let topSeen = $state<number | null>(null);
|
||||
async function refresh() {
|
||||
await loadBatches();
|
||||
const top = batches[0]?.id ?? null;
|
||||
if (top !== null && (topSeen === null || top > topSeen)) selected = top;
|
||||
topSeen = top;
|
||||
if (selected !== null) loadBatch(selected);
|
||||
}
|
||||
$effect(() => {
|
||||
if (active) untrack(refresh);
|
||||
});
|
||||
|
||||
// Beim Wechsel des Batches neu laden. Neue Batches erscheinen nach dem Lauf in der Liste.
|
||||
$effect(() => {
|
||||
const id = selected;
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
<TasksPanel active={tab === "tasks"} onrun={() => (tab = "bench")} />
|
||||
</div>
|
||||
<div hidden={tab !== "results"}>
|
||||
<ResultsPanel bind:selected={selectedBatch} />
|
||||
<ResultsPanel bind:selected={selectedBatch} active={tab === "results"} />
|
||||
</div>
|
||||
<div hidden={tab !== "reference"}>
|
||||
<ReferencePanel {tasks} onimported={showResults} />
|
||||
|
||||
Reference in New Issue
Block a user