Skip to content

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.

Studio browser: keep a temporary chat's hidden pages out of history (#14855)

Daniel Han71d24f7a0701
diff --git a/studio/frontend/src/features/browser/native-view.ts b/studio/frontend/src/features/browser/native-view.ts
index b1560b1cb39..c252c30e087 100644
--- a/studio/frontend/src/features/browser/native-view.ts
+++ b/studio/frontend/src/features/browser/native-view.ts
@@ -163,6 +163,14 @@ const loadingPages = new Set<string>();
function notePageStart(tabId: string, entry: Extract<BrowserEntry, { kind: "web" }>): void {
const fresh = pageEntries.get(tabId) !== entry;
pageEntries.set(tabId, entry);
+ const store = useBrowserStore.getState();
+ const tab = store.tabs.find((candidate) => candidate.id === tabId);
+ if (tab && tab.chat !== store.chat) {
+ // Off-screen chat: a self-navigation keeps the page's own flag, not the shown chat's incognito.
+ const own = entry.temporary === true;
+ temporaryPages.set(tabId, fresh ? own : (temporaryPages.get(tabId) ?? own));
+ return;
+ }
const kept = fresh ? entry.temporary === true : loadingPages.has(tabId) && temporaryPages.get(tabId) === true;
temporaryPages.set(tabId, useChatRuntimeStore.getState().incognito || kept);
}
diff --git a/studio/frontend/tests/browser-native-view-snapshot.test.ts b/studio/frontend/tests/browser-native-view-snapshot.test.ts
index 00c646f2718..1b357bf4fba 100644
--- a/studio/frontend/tests/browser-native-view-snapshot.test.ts
+++ b/studio/frontend/tests/browser-native-view-snapshot.test.ts
@@ -730,6 +730,43 @@ test("a native page begun beside a temporary chat keeps it through a redirect an
}
});
+test("a temporary chat's hidden page stays temporary when it navigates while another chat is shown", async () => {
+ const { useChatRuntimeStore } = await import("@/features/chat");
+ const runtime = useChatRuntimeStore.getState();
+ const store = useBrowserStore.getState();
+ const g = globalThis as { nativeViewListener?: (event: { payload: unknown }) => void; nativeViewVisits?: unknown };
+ const shown = store.chat;
+ runtime.setIncognito(true);
+ store.showChat("single:temporary-hidden");
+ store.openUrl("https://private.example/");
+ const tabId = useBrowserStore.getState().activeTabId as string;
+ const stop = startNativeViews();
+ try {
+ await frame();
+ const visits: { url: string; temporary: boolean }[] = [];
+ g.nativeViewVisits = visits;
+ const load = (url: string, loading: boolean) =>
+ g.nativeViewListener?.({ payload: { kind: "load", tabId, url, loading } });
+ load("https://private.example/", true);
+ load("https://private.example/", false);
+ store.showChat("single:ordinary-shown");
+ runtime.setIncognito(false);
+ await frame();
+ assert.ok(useBrowserStore.getState().tabs.some((tab) => tab.id === tabId));
+ load("https://private.example/next", true);
+ load("https://private.example/next", false);
+ assert.deepEqual(visits, [
+ { url: "https://private.example/", temporary: true },
+ { url: "https://private.example/next", temporary: true },
+ ]);
+ } finally {
+ runtime.setIncognito(false);
+ delete g.nativeViewVisits;
+ stop();
+ useBrowserStore.getState().showChat(shown);
+ }
+});
+
test("a new address asked for beside a temporary chat stays temporary when its native load starts after it", async () => {
const { useChatRuntimeStore } = await import("@/features/chat");
const stop = startNativeViews();