Monitor testId to update the page on test change
This commit is contained in:
parent
ff1a958220
commit
eb28499dfd
1 changed files with 14 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from "svelte";
|
import { onDestroy } from "svelte";
|
||||||
import { page } from "$app/state";
|
import { page } from "$app/state";
|
||||||
import { getTest, getReport, reanalyzeReport } from "$lib/api";
|
import { getTest, getReport, reanalyzeReport } from "$lib/api";
|
||||||
import type { Test, Report } from "$lib/api/types.gen";
|
import type { Test, Report } from "$lib/api/types.gen";
|
||||||
|
|
@ -74,10 +74,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
let lastTestId = null;
|
||||||
fetchTest();
|
function testChange(newTestId) {
|
||||||
startPolling();
|
if (lastTestId != newTestId) {
|
||||||
});
|
lastTestId = newTestId;
|
||||||
|
test = null;
|
||||||
|
fetchTest();
|
||||||
|
startPolling();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
testChange(page.params.test);
|
||||||
|
})
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
stopPolling();
|
stopPolling();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue