From 46fd5bbc86244c349abb4196a0eb93bf54a52172 Mon Sep 17 00:00:00 2001 From: leefer Date: Thu, 22 Oct 2026 03:51:16 +0800 Subject: [PATCH] fix: use Svelte reactive collections at isolated boundaries (HEL-760) Co-authored-by: multica-agent --- calliope-web/src/lib/components/desk/StudioDesk.svelte | 6 +++--- .../src/lib/components/generate/takeDelete.svelte.ts | 4 ++-- .../src/lib/components/manage/ComfyConnections.svelte | 3 ++- calliope-web/src/lib/components/manage/LlmModels.svelte | 3 ++- calliope-web/src/routes/agents/+page.svelte | 3 ++- calliope-web/src/routes/settings/+page.svelte | 3 ++- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/calliope-web/src/lib/components/desk/StudioDesk.svelte b/calliope-web/src/lib/components/desk/StudioDesk.svelte index e9ef2aa1..b1e307b7 100644 --- a/calliope-web/src/lib/components/desk/StudioDesk.svelte +++ b/calliope-web/src/lib/components/desk/StudioDesk.svelte @@ -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(); + const submittedIds = new SvelteSet(); // 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'); diff --git a/calliope-web/src/lib/components/generate/takeDelete.svelte.ts b/calliope-web/src/lib/components/generate/takeDelete.svelte.ts index d36f7522..b1d89b96 100644 --- a/calliope-web/src/lib/components/generate/takeDelete.svelte.ts +++ b/calliope-web/src/lib/components/generate/takeDelete.svelte.ts @@ -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(); - const entries = new Map< + const entries = new SvelteMap< number, { job: Job; diff --git a/calliope-web/src/lib/components/manage/ComfyConnections.svelte b/calliope-web/src/lib/components/manage/ComfyConnections.svelte index a13c49e9..e5cc7d65 100644 --- a/calliope-web/src/lib/components/manage/ComfyConnections.svelte +++ b/calliope-web/src/lib/components/manage/ComfyConnections.svelte @@ -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(); + const autoProbed = new SvelteSet(); $effect(() => { const list = endpoints; untrack(() => { diff --git a/calliope-web/src/lib/components/manage/LlmModels.svelte b/calliope-web/src/lib/components/manage/LlmModels.svelte index 50f3ec7a..b21ddc28 100644 --- a/calliope-web/src/lib/components/manage/LlmModels.svelte +++ b/calliope-web/src/lib/components/manage/LlmModels.svelte @@ -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(); + const autoProbed = new SvelteSet(); $effect(() => { const list = $settingsQuery.data?.llm_profiles ?? []; untrack(() => { diff --git a/calliope-web/src/routes/agents/+page.svelte b/calliope-web/src/routes/agents/+page.svelte index 49d781c8..08b52a8b 100644 --- a/calliope-web/src/routes/agents/+page.svelte +++ b/calliope-web/src/routes/agents/+page.svelte @@ -1,6 +1,7 @@