fix(editor): collapse shared results pane for unexecuted queries
This commit is contained in:
1 parent
a1e987ec0f
commit
63363c2834
2 files changed
+29
-1
No files matched your search
@@ -1342,7 +1342,14 @@ defineExpose({
|
||||
</Pane>
|
||||
<Pane v-if="(resultsPaneOpen || resultOnly) && !editorOnly" class="min-h-0" :size="resultOnly ? 100 : resultsPaneSize" :min-size="resultOnly ? 100 : 20">
|
||||
<div class="h-full flex flex-col">
|
||||
<div v-if="hasQueryOutput" class="flex h-10 shrink-0 items-center gap-1 border-b bg-muted/20 px-2">
|
||||
<!--
|
||||
The shared result surface (resultOnly) is always mounted regardless of
|
||||
whether the active tab has run a query yet, and this toolbar is the only
|
||||
place that renders the "hide results" chevron (see handleHideResultsPane).
|
||||
Gating it on hasQueryOutput alone left users with an always-open, empty
|
||||
shared pane and no way to collapse it (#8233).
|
||||
-->
|
||||
<div v-if="hasQueryOutput || resultOnly" class="flex h-10 shrink-0 items-center gap-1 border-b bg-muted/20 px-2">
|
||||
<Button
|
||||
v-if="activeTab.mode === 'query' && activeTab.result"
|
||||
variant="ghost"
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const contentAreaSource = readFileSync(new URL("../ContentArea.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("ContentArea shared result pane collapse (#8233)", () => {
|
||||
it("renders the results toolbar (and its hide-results chevron) even with no query output when resultOnly", () => {
|
||||
// The shared result surface (QueryResultSurface -> ContentArea result-only)
|
||||
// is mounted unconditionally by SqlEditorWorkspace regardless of whether the
|
||||
// active tab has run a query. handleHideResultsPane's chevron lives inside
|
||||
// this toolbar and is the only UI to collapse that shared pane, so gating
|
||||
// the toolbar on hasQueryOutput alone left it permanently open with no way
|
||||
// to close it until a query executed.
|
||||
expect(contentAreaSource).not.toMatch(/v-if="hasQueryOutput"\s+class="flex h-10 shrink-0 items-center gap-1 border-b bg-muted\/20 px-2"/);
|
||||
expect(contentAreaSource).toContain(`v-if="hasQueryOutput || resultOnly" class="flex h-10 shrink-0 items-center gap-1 border-b bg-muted/20 px-2"`);
|
||||
});
|
||||
|
||||
it("keeps handleHideResultsPane bubbling a toggle event for the shared (resultOnly) surface", () => {
|
||||
expect(contentAreaSource).toContain('if (props.resultOnly) {\n emit("toggleResultsPane");');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user