fix(quick-pane): refresh models and window lifecycle

This commit is contained in:
2026-08-26 15:58:01 +02:00
parent d34099771c
commit 4ec951bc05
7 changed files with 869 additions and 130 deletions
+42 -2
View File
@@ -65,8 +65,8 @@ test("Quick Pane keeps slash-containing model IDs atomic and reloads catalog on
readFile(new URL("../ui/src/model-catalog.ts", import.meta.url), "utf8"),
]);
assert.match(pane, /useState<ModelIdentity>/);
assert.match(pane, /provider: selectedModel\.provider/);
assert.match(pane, /modelId: selectedModel\.modelId/);
assert.match(pane, /provider: submittedModel\.provider/);
assert.match(pane, /modelId: submittedModel\.modelId/);
assert.doesNotMatch(pane, /selectedModel\.split/);
assert.match(pane, /onFocusChanged[\s\S]*?void loadModelCatalog\(\)/);
assert.match(
@@ -76,6 +76,46 @@ test("Quick Pane keeps slash-containing model IDs atomic and reloads catalog on
assert.match(catalog, /JSON\.parse\(value\)/);
});
test("Quick Pane dismiss and mutually exclusive window visibility stay native-serialized", async () => {
const [pane, nativeSource] = await Promise.all([
readFile(
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
"utf8",
),
readFile(new URL("../ui/src-tauri/src/lib.rs", import.meta.url), "utf8"),
]);
assert.match(pane, /invoke\("dismiss_quick_pane"\)/);
assert.doesNotMatch(pane, /getCurrentWindow\(\)\.hide\(\)/);
assert.match(nativeSource, /fn dismiss_quick_pane\(/);
assert.match(nativeSource, /dismiss_quick_pane,[\s\S]*create_session_runtime/);
assert.match(
nativeSource,
/struct WindowVisibility\(Mutex<ManagedWindowVisibility>\)/,
);
const mainShow = nativeSource.slice(
nativeSource.indexOf("fn apply_main_window_action"),
nativeSource.indexOf("fn get_or_create_quick_pane"),
);
const mainHideQuick = mainShow.indexOf("quick_pane.hide()");
const mainClearQuick = mainShow.indexOf('visibility.hidden("quick-pane")');
const showMain = mainShow.indexOf("window.show()");
assert.ok(mainShow.indexOf('get_webview_window("quick-pane")') >= 0);
assert.ok(mainHideQuick >= 0 && mainHideQuick < showMain);
assert.ok(mainClearQuick >= 0 && mainClearQuick < showMain);
const quickShow = nativeSource.slice(
nativeSource.indexOf("fn toggle_quick_pane"),
nativeSource.indexOf("fn requested_new_worktree_argument"),
);
const quickHideMain = quickShow.indexOf("main.hide()");
const quickClearMain = quickShow.indexOf('visibility.hidden("main")');
const showQuick = quickShow.indexOf("window.show()");
assert.ok(quickShow.indexOf('get_webview_window("main")') >= 0);
assert.ok(quickHideMain >= 0 && quickHideMain < showQuick);
assert.ok(quickClearMain >= 0 && quickClearMain < showQuick);
});
test("Quick Pane routes extension responses through existing bridge command", async () => {
const source = await readFile(
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),