fix: use Svelte reactive collections at isolated boundaries (HEL-760)

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-22 03:51:16 +08:00
co-authored by multica-agent
parent fc6616b118
commit 46fd5bbc86
6 changed files with 13 additions and 9 deletions
@@ -7,7 +7,7 @@
import { createQuery, useQueryClient } from '@tanstack/svelte-query';
import { toStore } from 'svelte/store';
import { tick, untrack } from 'svelte';
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
import { SvelteMap, SvelteSet, SvelteURL } from 'svelte/reactivity';
import { page } from '$app/state';
import { goto } from '$app/navigation';
import '$lib/components/ui/Icon.svelte';
@@ -199,7 +199,7 @@
// Jobs enqueued from this desk — a fast failure can land before the
// jobs list refetch knows about them.
const submittedIds = new Set<number>();
const submittedIds = new SvelteSet<number>();
// D 批: one-shot completion flash / failure shake (SSE-driven) and the
// 5-second undo window for record deletes.
@@ -848,7 +848,7 @@
);
function mediumLink(next: DeskKind) {
if (slotBusy || submitting) return;
const url = new URL(page.url);
const url = new SvelteURL(page.url);
url.pathname = '/create';
url.searchParams.set('kind', next);
url.searchParams.delete('wf');
@@ -1,4 +1,4 @@
import { SvelteSet } from "svelte/reactivity";
import { SvelteMap, SvelteSet } from "svelte/reactivity";
import type { QueryClient } from "@tanstack/svelte-query";
import { apiErrorMessage, playgroundApi } from "$lib/api";
import type { Job } from "$lib/comfy/types";
@@ -35,7 +35,7 @@ const UNDO_MS = 5000;
export function createTakeDeleteQueue(client: QueryClient): TakeDeleteQueue {
const pending = new SvelteSet<number>();
const entries = new Map<
const entries = new SvelteMap<
number,
{
job: Job;
@@ -6,6 +6,7 @@
useQueryClient,
} from "@tanstack/svelte-query";
import { untrack } from "svelte";
import { SvelteSet } from "svelte/reactivity";
import { fade } from "svelte/transition";
import Modal from "$lib/components/ui/Modal.svelte";
@@ -385,7 +386,7 @@
// Probe every connection once per visit so the cards show real state
// instead of 「未测试」; results younger than a minute are reused.
const autoProbed = new Set<string>();
const autoProbed = new SvelteSet<string>();
$effect(() => {
const list = endpoints;
untrack(() => {
@@ -5,6 +5,7 @@
useQueryClient,
} from "@tanstack/svelte-query";
import { untrack } from "svelte";
import { SvelteSet } from "svelte/reactivity";
import { fade } from "svelte/transition";
import Modal from "$lib/components/ui/Modal.svelte";
@@ -515,7 +516,7 @@
// Test each model once per visit (1-token probe) so the cards show real
// state instead of 「未测试」; results younger than 10 minutes are reused.
const autoProbed = new Set<string>();
const autoProbed = new SvelteSet<string>();
$effect(() => {
const list = $settingsQuery.data?.llm_profiles ?? [];
untrack(() => {