mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-21 21:38:22 +00:00
fix(desktop): respect table tab reuse policy on editor table click
This commit is contained in:
@@ -1709,7 +1709,7 @@ async function onClickTable(table: SqlObjectNavigationTarget) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await openTableTarget(target, { tableInfoTab: "ddl" });
|
||||
await openObjectBrowserTableTarget(target);
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e) }), 5000);
|
||||
}
|
||||
@@ -1719,7 +1719,7 @@ async function onViewTableData(table: SqlObjectNavigationTarget) {
|
||||
const target = tableTargetFromActiveTab(table);
|
||||
if (!target) return;
|
||||
try {
|
||||
await openTableTarget(target);
|
||||
await openObjectBrowserTableTarget(target);
|
||||
} catch (e: any) {
|
||||
toast(t("connection.connectFailed", { message: translateBackendError(t, e) }), 5000);
|
||||
}
|
||||
|
||||
@@ -217,6 +217,20 @@ describe("useNavigationTargets with the real query store", () => {
|
||||
expect(queryStore.activeTabId).toBe(sidebarTabId);
|
||||
});
|
||||
|
||||
it("reuses existing table tab when navigating via object browser target in same-table mode", async () => {
|
||||
mocks.settingsStore.editorSettings.dataTabReuseMode = "same-table";
|
||||
const { navigation, queryStore } = await setupNavigation();
|
||||
const target = { connectionId: "connection-1", database: "app", schema: "public", tableName: "users", tableType: "TABLE" };
|
||||
|
||||
await navigation.openObjectBrowserTableTarget(target);
|
||||
const firstTabId = queryStore.activeTabId;
|
||||
|
||||
await navigation.openObjectBrowserTableTarget(target);
|
||||
|
||||
expect(queryStore.tabs).toHaveLength(1);
|
||||
expect(queryStore.activeTabId).toBe(firstTabId);
|
||||
});
|
||||
|
||||
it("reuses a restored legacy MySQL tab when the same table is opened from the sidebar", async () => {
|
||||
mocks.connectionStore.getConfig.mockImplementation((connectionId: string) => ({ id: connectionId, db_type: "mysql" }));
|
||||
mocks.loadOpenTabsState.mockResolvedValue({
|
||||
|
||||
Reference in New Issue
Block a user