Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio Desktop: sync pinned models and overrides after the backend port is known (#15821)
Daniel Han0d70d74183b0
diff --git a/studio/frontend/src/app/routes/__root.tsx b/studio/frontend/src/app/routes/__root.tsxindex 9338be3fcc8..130a2adb02b 100644--- a/studio/frontend/src/app/routes/__root.tsx+++ b/studio/frontend/src/app/routes/__root.tsx@@ -450,14 +450,17 @@ function RootLayout() {: DEFAULT_DOCUMENT_TITLE;}, [documentTitle]);+ // Desktop mounts this root before the port exists; authFetch retries keep the URL it started with.+ const desktopShellReady = useDesktopShellReady();+// Settings predating the server override map live only locally; backfill once after auth.useEffect(() => {- if (isAuthFlowRoute) {+ if (isAuthFlowRoute || !desktopShellReady) {return;}void backfillModelOverrides();void hydratePins();- }, [isAuthFlowRoute]);+ }, [isAuthFlowRoute, desktopShellReady]);useEffect(() => {if (isAuthFlowRoute) {@@ -516,7 +519,6 @@ function RootLayout() {const pathLeasesSupported = useNativePathLeasesSupported();const ragUnavailable = useRagAvailabilityStore((s) => s.isUnavailable());const openingFolder = useOpeningFolder();- const desktopShellReady = useDesktopShellReady();// Menu items for web shortcuts are live exactly while a mounted handler would take them.const sidebarMounted = useShortcutAvailable("toggleSidebar", hasAppMenus);const findMounted = useShortcutAvailable("findInPage", hasAppMenus);diff --git a/studio/frontend/tests/desktop-startup-sync-port.test.ts b/studio/frontend/tests/desktop-startup-sync-port.test.tsnew file mode 100644index 00000000000..6e93956669d--- /dev/null+++ b/studio/frontend/tests/desktop-startup-sync-port.test.ts@@ -0,0 +1,29 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// Desktop mounts the root before the backend port exists, and authFetch resolves its URL once,+// so the startup pin and override sync must wait for the Desktop shell.++import assert from "node:assert/strict";+import { readFile } from "node:fs/promises";+import test from "node:test";++const read = (path: string) => readFile(new URL(path, import.meta.url), "utf8");++test("the startup pin and override sync waits for the Desktop shell", async () => {+ const root = await read("../src/app/routes/__root.tsx");+ const start = root.indexOf("void backfillModelOverrides();");+ assert.ok(start > 0, "root no longer starts the override backfill");+ const effectStart = root.lastIndexOf("useEffect(() => {", start);+ const effect = root.slice(effectStart, root.indexOf("]);", start) + 3);+ assert.match(effect, /void hydratePins\(\);/);+ assert.match(effect, /if \(isAuthFlowRoute \|\| !desktopShellReady\) \{\s*return;\s*\}/);+ assert.match(effect, /\}, \[isAuthFlowRoute, desktopShellReady\]\);$/);+ assert.ok(root.indexOf("const desktopShellReady = useDesktopShellReady();") < effectStart);++ // Open from the start on the web; on Desktop only once the backend runs and sign-in finished.+ assert.match(await read("../src/app/desktop-shell-ready.ts"), /let ready = !isTauri;/);+ const provider = await read("../src/app/provider.tsx");+ assert.match(provider, /const canMountApp = status === "running" && desktopAuthReady;/);+ assert.match(provider, /setDesktopShellReady\(canMountApp && appShellReady\);/);+});