fix(tabs): reuse data tabs only for the same table

This commit is contained in:
zipg authored and GitHub committed 2026-08-03 17:05:56 +08:00
1 parent 6e4363be36
commit 51560c49ae
16 files changed
+115 -23

No files matched your search

@@ -169,6 +169,17 @@ describe("useSidebarDataOpenRuntime", () => {
expect(mocks.tabs).toHaveLength(1);
});
it("keeps different sidebar tables independent when reuse is enabled", async () => {
mocks.reuseDataTab = true;
const ordersNode = { ...tableNode, id: "table-orders", label: "orders" };
await useSidebarDataOpenRuntime().openData(tableNode);
await useSidebarDataOpenRuntime().openData(ordersNode);
expect(mocks.tabs).toHaveLength(2);
expect(mocks.tabs.map((tab) => tab.title)).toEqual(["users", "orders"]);
});
it("creates a new HBase tab for the same table when reuse is disabled", async () => {
mocks.databaseType = "hbase";
@@ -178,6 +189,16 @@ describe("useSidebarDataOpenRuntime", () => {
expect(mocks.tabs).toHaveLength(2);
});
it("keeps different HBase tables independent when reuse is enabled", async () => {
mocks.databaseType = "hbase";
mocks.reuseDataTab = true;
await useSidebarDataOpenRuntime().openData(tableNode);
await useSidebarDataOpenRuntime().openData({ ...tableNode, id: "table-orders", label: "orders" });
expect(mocks.tabs).toHaveLength(2);
});
it("starts cold-cache OceanBase metadata before the table query", async () => {
await useSidebarDataOpenRuntime().openData(tableNode);