Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(sidebar): make auto-expanding on connect configurable

HighBigSky5e265b199175
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 6666aa8539..dc89718e02 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -986,6 +986,7 @@ const editSidebarSearchOpenedDatabasesOnly = ref(settingsStore.editorSettings.si
const editAutoSelectActiveSidebarNode = ref(settingsStore.editorSettings.autoSelectActiveSidebarNode);
const editSidebarPinDefaultDatabase = ref(settingsStore.editorSettings.sidebarPinDefaultDatabase);
const editSidebarBrowseObjectsOnDatabaseActivation = ref(settingsStore.editorSettings.sidebarBrowseObjectsOnDatabaseActivation);
+const editSidebarExpandTreeOnConnect = ref(settingsStore.editorSettings.sidebarExpandTreeOnConnect);
const editOpenTabsRestoreMode = ref<OpenTabsRestoreMode>(settingsStore.editorSettings.openTabsRestoreMode);
const editAutoReloadRestoredDataTabsOnOpen = ref(settingsStore.editorSettings.autoReloadRestoredDataTabsOnOpen);
const editDisconnectTabHandlingMode = ref<DisconnectTabHandlingMode>(settingsStore.editorSettings.disconnectTabHandlingMode);
@@ -1320,6 +1321,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
autoSelectActiveSidebarNode: editAutoSelectActiveSidebarNode.value,
sidebarPinDefaultDatabase: editSidebarPinDefaultDatabase.value,
sidebarBrowseObjectsOnDatabaseActivation: editSidebarBrowseObjectsOnDatabaseActivation.value,
+ sidebarExpandTreeOnConnect: editSidebarExpandTreeOnConnect.value,
openTabsRestoreMode: editOpenTabsRestoreMode.value,
autoReloadRestoredDataTabsOnOpen: editAutoReloadRestoredDataTabsOnOpen.value,
disconnectTabHandlingMode: editDisconnectTabHandlingMode.value,
@@ -2028,6 +2030,7 @@ function syncEditorSettingsDraftFromStore() {
editAutoSelectActiveSidebarNode.value = settingsStore.editorSettings.autoSelectActiveSidebarNode;
editSidebarPinDefaultDatabase.value = settingsStore.editorSettings.sidebarPinDefaultDatabase;
editSidebarBrowseObjectsOnDatabaseActivation.value = settingsStore.editorSettings.sidebarBrowseObjectsOnDatabaseActivation;
+ editSidebarExpandTreeOnConnect.value = settingsStore.editorSettings.sidebarExpandTreeOnConnect;
editOpenTabsRestoreMode.value = settingsStore.editorSettings.openTabsRestoreMode;
editAutoReloadRestoredDataTabsOnOpen.value = settingsStore.editorSettings.autoReloadRestoredDataTabsOnOpen;
editDisconnectTabHandlingMode.value = settingsStore.editorSettings.disconnectTabHandlingMode;
@@ -2204,6 +2207,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
autoSelectActiveSidebarNode: editAutoSelectActiveSidebarNode,
sidebarPinDefaultDatabase: editSidebarPinDefaultDatabase,
sidebarBrowseObjectsOnDatabaseActivation: editSidebarBrowseObjectsOnDatabaseActivation,
+ sidebarExpandTreeOnConnect: editSidebarExpandTreeOnConnect,
openTabsRestoreMode: editOpenTabsRestoreMode,
autoReloadRestoredDataTabsOnOpen: editAutoReloadRestoredDataTabsOnOpen,
disconnectTabHandlingMode: editDisconnectTabHandlingMode,
@@ -2800,6 +2804,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editAutoSelectActiveSidebarNode.value = DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode;
editSidebarPinDefaultDatabase.value = DEFAULT_EDITOR_SETTINGS.sidebarPinDefaultDatabase;
editSidebarBrowseObjectsOnDatabaseActivation.value = DEFAULT_EDITOR_SETTINGS.sidebarBrowseObjectsOnDatabaseActivation;
+ editSidebarExpandTreeOnConnect.value = DEFAULT_EDITOR_SETTINGS.sidebarExpandTreeOnConnect;
editOpenTabsRestoreMode.value = DEFAULT_EDITOR_SETTINGS.openTabsRestoreMode;
editAutoReloadRestoredDataTabsOnOpen.value = DEFAULT_EDITOR_SETTINGS.autoReloadRestoredDataTabsOnOpen;
editDisconnectTabHandlingMode.value = DEFAULT_EDITOR_SETTINGS.disconnectTabHandlingMode;
@@ -3028,6 +3033,7 @@ function resetAllDefaults() {
editAutoSelectActiveSidebarNode.value = DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode;
editSidebarPinDefaultDatabase.value = DEFAULT_EDITOR_SETTINGS.sidebarPinDefaultDatabase;
editSidebarBrowseObjectsOnDatabaseActivation.value = DEFAULT_EDITOR_SETTINGS.sidebarBrowseObjectsOnDatabaseActivation;
+ editSidebarExpandTreeOnConnect.value = DEFAULT_EDITOR_SETTINGS.sidebarExpandTreeOnConnect;
editOpenTabsRestoreMode.value = DEFAULT_EDITOR_SETTINGS.openTabsRestoreMode;
editAutoReloadRestoredDataTabsOnOpen.value = DEFAULT_EDITOR_SETTINGS.autoReloadRestoredDataTabsOnOpen;
editDisconnectTabHandlingMode.value = DEFAULT_EDITOR_SETTINGS.disconnectTabHandlingMode;
@@ -9372,6 +9378,15 @@ onUnmounted(() => {
</div>
<Switch id="sidebar-pin-default-database" v-model="editSidebarPinDefaultDatabase" />
</div>
+ <div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
+ <div class="flex items-center gap-2">
+ <Label for="sidebar-expand-tree-on-connect">{{ t("settings.sidebarExpandTreeOnConnect") }}</Label>
+ <HelpTooltip :label="t('settings.sidebarExpandTreeOnConnect')">
+ {{ t("settings.sidebarExpandTreeOnConnectDescription") }}
+ </HelpTooltip>
+ </div>
+ <Switch id="sidebar-expand-tree-on-connect" v-model="editSidebarExpandTreeOnConnect" />
+ </div>
<div class="settings-item space-y-2 rounded-md border bg-muted/20 px-3 py-2">
<div class="flex items-center gap-2">
<Label for="open-tabs-restore-mode">{{ t("settings.openTabsRestoreMode") }}</Label>
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index d61c714657..d1d83eee1a 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -7933,6 +7933,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Aktiv olduqda, varsayılan verilənlər bazası siyahının yuxarısında göstərilir. Deaktiv olduqda, əlifba sırası ilə düzülür.",
sidebarBrowseObjectsOnDatabaseActivation: "Verilənlər bazası aktivləşdirildikdə obyektlərə bax",
sidebarBrowseObjectsOnDatabaseActivationDescription: 'Aktiv olduqda, seçilmiş tək və ya ikiqat klik rejimi ilə verilənlər bazası və ya sxem düyününün aktivləşdirilməsi "Obyektlərə bax" vərəqini də açır.',
+ sidebarExpandTreeOnConnect: "Qoşulmadan sonra obyekt ağacını aç",
+ sidebarExpandTreeOnConnectDescription: "Aktiv olanda uğurlu qoşulma yan paneldə qoşulma və standart verilənlər bazası düyünlərini avtomatik açır; deaktiv olanda düyünləri əl ilə açırsınız. Çoxsaylı sxemli bazalar üçün söndürün.",
openTabsRestoreMode: "Başladıqda vərəqləri bərpa et",
openTabsRestoreModeDescription: "DBX-in sonuncu dəfə açıq olan vərəqləri necə bərpa edəcəyini seçin.",
openTabsRestoreModeAll: "Bütün vərəqləri saxla",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 41468a4650..a0992eb0ca 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -10365,6 +10365,8 @@ export default {
sidebarPinDefaultDatabaseDescription: "When enabled, the default database appears at the top of the database list. When disabled, it is sorted alphabetically.",
sidebarBrowseObjectsOnDatabaseActivation: "Browse objects when activating a database",
sidebarBrowseObjectsOnDatabaseActivationDescription: 'When enabled, activating a database or schema node using the selected single- or double-click mode also opens the "Browse Objects" tab.',
+ sidebarExpandTreeOnConnect: "Expand object tree after connecting",
+ sidebarExpandTreeOnConnectDescription: "When enabled, a successful connection automatically expands the connection and its default database in the sidebar; when disabled, expand nodes manually. Turn off for databases with many schemas to avoid the cost of expanding everything at once.",
openTabsRestoreMode: "Restore tabs on launch",
openTabsRestoreModeDescription: "Choose how DBX restores tabs that were open last time.",
openTabsRestoreModeAll: "Keep all tabs",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index d60f07eb65..d5bf69a3c0 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -9152,6 +9152,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Cuando está habilitado, la base de datos predeterminada se muestra en la parte superior de la lista. Cuando está deshabilitado, se ordena alfabéticamente.",
sidebarBrowseObjectsOnDatabaseActivation: "Explorar objetos al activar una base de datos",
sidebarBrowseObjectsOnDatabaseActivationDescription: 'Si está activado, al activar un nodo de base de datos o esquema con el modo seleccionado de uno o dos clics también se abre la pestaña "Explorar objetos".',
+ sidebarExpandTreeOnConnect: "Expandir el árbol de objetos al conectar",
+ sidebarExpandTreeOnConnectDescription: "Si está activado, una conexión correcta expande automáticamente la conexión y su base de datos predeterminada en la barra lateral; si está desactivado, expanda los nodos manualmente. Desactívelo en bases de datos con muchos esquemas.",
openTabsRestoreMode: "Restaurar pestañas al iniciar",
openTabsRestoreModeDescription: "Elige cómo DBX restaura las pestañas que estaban abiertas la última vez.",
openTabsRestoreModeAll: "Conservar todas las pestañas",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index a246eaacfb..b1ff426bcd 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -8686,6 +8686,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Saat diaktifkan, database default akan muncul di bagian atas daftar database. Saat dinonaktifkan, akan diurutkan berdasarkan abjad.",
sidebarBrowseObjectsOnDatabaseActivation: "Jelajahi objek saat mengaktifkan database",
sidebarBrowseObjectsOnDatabaseActivationDescription: 'Jika diaktifkan, mengaktifkan node database atau skema menggunakan mode klik tunggal atau ganda yang dipilih juga membuka tab "Jelajahi Objek".',
+ sidebarExpandTreeOnConnect: "Perluas pohon objek setelah terhubung",
+ sidebarExpandTreeOnConnectDescription: "Saat diaktifkan, koneksi yang berhasil otomatis memperluas node koneksi dan database bawaan di bilah samping; saat dinonaktifkan, perluas node secara manual. Matikan untuk database dengan banyak skema.",
openTabsRestoreMode: "Pulihkan tab saat peluncuran",
openTabsRestoreModeDescription: "Pilih bagaimana DBX memulihkan tab yang terbuka terakhir kali.",
openTabsRestoreModeAll: "Simpan semua tab",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index 76c029bb3a..b66c9ca09b 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -8930,6 +8930,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Se abilitato, il database predefinito viene mostrato in cima all'elenco dei database. Se disabilitato, viene ordinato alfabeticamente.",
sidebarBrowseObjectsOnDatabaseActivation: "Esplora oggetti all'attivazione di un database",
sidebarBrowseObjectsOnDatabaseActivationDescription: "Se abilitato, l'attivazione di un nodo database o schema con la modalità a clic singolo o doppio selezionata apre anche la scheda «Esplora oggetti».",
+ sidebarExpandTreeOnConnect: "Espandi l'albero degli oggetti dopo la connessione",
+ sidebarExpandTreeOnConnectDescription: "Se abilitato, una connessione riuscita espande automaticamente la connessione e il database predefinito nella barra laterale; se disabilitato, espandi i nodi manualmente. Disattivare per database con molti schemi.",
openTabsRestoreMode: "Ripristina schede all'avvio",
openTabsRestoreModeDescription: "Scegli come DBX ripristina le schede aperte l'ultima volta.",
openTabsRestoreModeAll: "Mantieni tutte le schede",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index ba7d91c414..d5be2efe6c 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -8934,6 +8934,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "有効にすると、デフォルトデータベースがデータベース一覧の先頭に固定されます。無効にすると、アルファベット順に並べ替えられます。",
sidebarBrowseObjectsOnDatabaseActivation: "データベースノードのアクティブ化時にオブジェクトを参照",
sidebarBrowseObjectsOnDatabaseActivationDescription: "有効にすると、選択したシングルクリックまたはダブルクリック方式でデータベースまたはスキーマノードをアクティブ化した際に、サイドバーを展開すると同時に「オブジェクトを参照」タブを開きます。",
+ sidebarExpandTreeOnConnect: "接続後にオブジェクトツリーを展開",
+ sidebarExpandTreeOnConnectDescription: "有効にすると、接続成功後にサイドバーの接続ノードと既定のデータベースノードを自動的に展開します。無効にした場合は手動で展開します。スキーマが多いデータベースではオフを推奨します。",
openTabsRestoreMode: "起動時にタブを復元",
openTabsRestoreModeDescription: "DBX 起動時に前回開いていたタブをどのように復元するかを選択します。",
openTabsRestoreModeAll: "すべてのタブを保持",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 67ed5b8fd6..fe8b89d5d9 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -9052,6 +9052,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "활성화하면 기본 데이터베이스가 데이터베이스 목록 상단에 고정 표시됩니다. 비활성화하면 알파벳순으로 정렬됩니다.",
sidebarBrowseObjectsOnDatabaseActivation: "데이터베이스 노드 활성화 시 객체 탐색",
sidebarBrowseObjectsOnDatabaseActivationDescription: '활성화하면 선택한 한 번 클릭 또는 두 번 클릭 방식으로 데이터베이스나 스키마 노드를 활성화할 때 사이드바를 펼치면서 "객체 탐색" 탭을 엽니다.',
+ sidebarExpandTreeOnConnect: "연결 후 객체 트리 펼치기",
+ sidebarExpandTreeOnConnectDescription: "활성화하면 연결 성공 후 사이드바에서 연결 노드와 기본 데이터베이스 노드를 자동으로 펼칩니다. 비활성화하면 수동으로 펼칩니다. 스키마가 많은 데이터베이스는 끄는 것을 권장합니다.",
openTabsRestoreMode: "실행 시 탭 복원",
openTabsRestoreModeDescription: "DBX가 지난번에 열려 있던 탭을 복원하는 방법을 선택하세요.",
openTabsRestoreModeAll: "모든 탭 유지",
diff --git a/apps/desktop/src/i18n/locales/pl.ts b/apps/desktop/src/i18n/locales/pl.ts
index ac097be7e2..0501d71545 100644
--- a/apps/desktop/src/i18n/locales/pl.ts
+++ b/apps/desktop/src/i18n/locales/pl.ts
@@ -8751,6 +8751,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Gdy włączone, domyślna baza danych pojawia się na samej górze listy. Gdy wyłączone, jest sortowana alfabetycznie.",
sidebarBrowseObjectsOnDatabaseActivation: "Przeglądaj obiekty po aktywacji bazy danych",
sidebarBrowseObjectsOnDatabaseActivationDescription: "Gdy włączone, aktywacja węzła bazy danych lub schematu wybranym trybem pojedynczego/podwójnego kliknięcia otwiera również kartę „Przeglądaj obiekty”.",
+ sidebarExpandTreeOnConnect: "Rozwijaj drzewo obiektów po połączeniu",
+ sidebarExpandTreeOnConnectDescription: "Gdy włączone, udane połączenie automatycznie rozwija połączenie i jego domyślną bazę danych na pasku bocznym; gdy wyłączone, rozwijaj węzły ręcznie. Wyłącz dla baz danych z wieloma schematami.",
openTabsRestoreMode: "Przywracanie kart przy uruchomieniu",
openTabsRestoreModeDescription: "Wybierz, w jaki sposób DBX przywraca karty otwarte podczas poprzedniej sesji.",
openTabsRestoreModeAll: "Zachowaj wszystkie karty",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 1439ff673c..6c01d51db7 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -8929,6 +8929,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Quando ativado, o banco de dados padrão aparece no topo da lista de bancos de dados. Quando desativado, é ordenado em ordem alfabética.",
sidebarBrowseObjectsOnDatabaseActivation: "Explorar objetos ao ativar um banco de dados",
sidebarBrowseObjectsOnDatabaseActivationDescription: 'Quando ativado, ativar um nó de banco de dados ou esquema com o modo selecionado de clique simples ou duplo também abre a aba "Explorar Objetos".',
+ sidebarExpandTreeOnConnect: "Expandir a árvore de objetos após conectar",
+ sidebarExpandTreeOnConnectDescription: "Quando ativado, uma conexão bem-sucedida expande automaticamente a conexão e o banco de dados padrão na barra lateral; quando desativado, expanda os nós manualmente. Desative em bancos de dados com muitos esquemas.",
openTabsRestoreMode: "Restaurar abas ao iniciar",
openTabsRestoreModeDescription: "Escolha como o DBX restaura as abas que estavam abertas na última vez.",
openTabsRestoreModeAll: "Manter todas as abas",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index 279172bcf4..db9afcb206 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -10506,6 +10506,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Если включено, база данных по умолчанию отображается в начале списка. Если отключено, она сортируется по алфавиту.",
sidebarBrowseObjectsOnDatabaseActivation: "Просматривать объекты при активации базы данных",
sidebarBrowseObjectsOnDatabaseActivationDescription: "Если включено, активация узла базы данных или схемы выбранным режимом (один или двойной клик) также открывает вкладку «Просмотр объектов».",
+ sidebarExpandTreeOnConnect: "Разворачивать дерево объектов после подключения",
+ sidebarExpandTreeOnConnectDescription: "Если включено, после успешного подключения соединение и его база данных по умолчанию автоматически разворачиваются на боковой панели; если выключено, разворачивайте узлы вручную. Отключите для баз данных с большим числом схем.",
openTabsRestoreMode: "Восстанавливать вкладки при запуске",
openTabsRestoreModeDescription: "Выберите, как DBX восстанавливает вкладки, открытые в прошлый раз.",
openTabsRestoreModeAll: "Сохранять все вкладки",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index 211316c378..7395ed8420 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -10898,6 +10898,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "เมื่อเปิดใช้ ฐานข้อมูลเริ่มต้นจะแสดงด้านบนสุดของรายการฐานข้อมูล เมื่อปิดจะเรียงตามตัวอักษร",
sidebarBrowseObjectsOnDatabaseActivation: "เรียกดูออบเจ็กต์เมื่อเปิดใช้ฐานข้อมูล",
sidebarBrowseObjectsOnDatabaseActivationDescription: "เมื่อเปิดใช้ การเปิดโหนดฐานข้อมูลหรือ Schema ด้วยโหมดคลิกเดียวหรือดับเบิลคลิกที่เลือก จะเปิดแท็บ Browse Objects ด้วย",
+ sidebarExpandTreeOnConnect: "ขยายแผนผังออบเจ็กต์หลังเชื่อมต่อ",
+ sidebarExpandTreeOnConnectDescription: "เมื่อเปิดใช้ การเชื่อมต่อสำเร็จจะขยายโหนดการเชื่อมต่อและฐานข้อมูลเริ่มต้นในแถบด้านข้างโดยอัตโนมัติ; เมื่อปิดใช้ ต้องขยายโหนดด้วยตนเอง แนะนำให้ปิดสำหรับฐานข้อมูลที่มี Schema จำนวนมาก",
openTabsRestoreMode: "กู้คืนแท็บเมื่อเปิดแอป",
openTabsRestoreModeDescription: "เลือกวิธีที่ DBX กู้คืนแท็บที่เปิดไว้ครั้งล่าสุด",
openTabsRestoreModeAll: "เก็บแท็บทั้งหมด",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index c260eb17d2..26ad4a4a1b 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -7816,6 +7816,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "Etkinleştirildiğinde, varsayılan veritabanı veritabanı listesinin en üstünde görüntülenir. Devre dışı bırakıldığında alfabetik olarak sıralanır.",
sidebarBrowseObjectsOnDatabaseActivation: "Veritabanı etkinleştirilirken nesnelere gözat",
sidebarBrowseObjectsOnDatabaseActivationDescription: 'Etkinleştirildiğinde, seçili tek veya çift tıklama moduyla bir veritabanı ya da şema düğümünü etkinleştirmek "Nesnelere Gözat" sekmesini de açar.',
+ sidebarExpandTreeOnConnect: "Bağlandıktan sonra nesne ağacını genişlet",
+ sidebarExpandTreeOnConnectDescription: "Etkinleştirildiğinde başarılı bir bağlantı, kenar çubuğunda bağlantıyı ve varsayılan veritabanını otomatik olarak genişletir; devre dışı bırakıldığında düğümleri elle genişletirsiniz. Şeması çok olan veritabanları için kapatın.",
openTabsRestoreMode: "Açılışta sekmeleri geri yükle",
openTabsRestoreModeDescription: "DBX'in en son açık olan sekmeleri nasıl geri yükleyeceğini seçin.",
openTabsRestoreModeAll: "Tüm sekmeleri koru",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 565ea0a498..df3a5704fd 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -10332,6 +10332,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "开启后,默认数据库在数据库列表中置顶显示;关闭后按字母正常排序。",
sidebarBrowseObjectsOnDatabaseActivation: "激活数据库节点时浏览对象",
sidebarBrowseObjectsOnDatabaseActivationDescription: "开启后,按照所选的单击或双击激活方式操作数据库或模式节点时,会同时展开侧边栏并打开“浏览对象”标签页。",
+ sidebarExpandTreeOnConnect: "连接后自动展开对象树",
+ sidebarExpandTreeOnConnectDescription: "开启后,连接成功会自动展开侧边栏里的连接与默认数据库节点;关闭后需要手动逐层展开。模式较多的库建议关闭,避免全量展开造成卡顿。",
openTabsRestoreMode: "启动时恢复标签页",
openTabsRestoreModeDescription: "选择 DBX 启动时如何恢复上次打开的标签页。",
openTabsRestoreModeAll: "保留所有标签",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index b8f9d877c3..ea4b499db0 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -8053,6 +8053,8 @@ export default withEnglishFallback({
sidebarPinDefaultDatabaseDescription: "開啟後,預設資料庫在資料庫清單中置頂顯示;關閉後依字母正常排序。",
sidebarBrowseObjectsOnDatabaseActivation: "啟用資料庫節點時瀏覽物件",
sidebarBrowseObjectsOnDatabaseActivationDescription: "開啟後,依照所選的單擊或雙擊啟用方式操作資料庫或結構描述節點時,會同時展開側邊欄並開啟「瀏覽物件」分頁。",
+ sidebarExpandTreeOnConnect: "連線後自動展開物件樹",
+ sidebarExpandTreeOnConnectDescription: "開啟後,連線成功會自動展開側邊欄裡的連線與預設資料庫節點;關閉後需要手動逐層展開。結構描述較多的資料庫建議關閉,避免全量展開造成卡頓。",
openTabsRestoreMode: "啟動時還原分頁",
openTabsRestoreModeDescription: "選擇 DBX 啟動時如何還原上次開啟的分頁。",
openTabsRestoreModeAll: "保留所有分頁",
diff --git a/apps/desktop/src/lib/settings/editorSettingsDraft.ts b/apps/desktop/src/lib/settings/editorSettingsDraft.ts
index 11101e089c..a3ffd9edef 100644
--- a/apps/desktop/src/lib/settings/editorSettingsDraft.ts
+++ b/apps/desktop/src/lib/settings/editorSettingsDraft.ts
@@ -122,6 +122,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
"autoSelectActiveSidebarNode",
"sidebarPinDefaultDatabase",
"sidebarBrowseObjectsOnDatabaseActivation",
+ "sidebarExpandTreeOnConnect",
"openTabsRestoreMode",
"autoReloadRestoredDataTabsOnOpen",
"disconnectTabHandlingMode",
diff --git a/apps/desktop/src/lib/settings/settingsSearch.ts b/apps/desktop/src/lib/settings/settingsSearch.ts
index 909767e92a..96c903b43b 100644
--- a/apps/desktop/src/lib/settings/settingsSearch.ts
+++ b/apps/desktop/src/lib/settings/settingsSearch.ts
@@ -378,6 +378,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
{ id: "navigation-active-node", category: "navigation", titleKey: "settings.autoSelectActiveSidebarNode", descriptionKey: "settings.autoSelectActiveSidebarNodeDescription", targetId: "navigation" },
{ id: "navigation-sidebar-pin-default-database", category: "navigation", titleKey: "settings.sidebarPinDefaultDatabase", descriptionKey: "settings.sidebarPinDefaultDatabaseDescription", targetId: "navigation" },
{ id: "navigation-browse-objects-on-database-activation", category: "navigation", titleKey: "settings.sidebarBrowseObjectsOnDatabaseActivation", descriptionKey: "settings.sidebarBrowseObjectsOnDatabaseActivationDescription", targetId: "navigation" },
+ { id: "navigation-expand-tree-on-connect", category: "navigation", titleKey: "settings.sidebarExpandTreeOnConnect", descriptionKey: "settings.sidebarExpandTreeOnConnectDescription", targetId: "navigation" },
{
id: "navigation-tabs-restore",
category: "navigation",
diff --git a/apps/desktop/src/lib/settings/settingsTransfer.ts b/apps/desktop/src/lib/settings/settingsTransfer.ts
index fda2670883..7f6d92f79c 100644
--- a/apps/desktop/src/lib/settings/settingsTransfer.ts
+++ b/apps/desktop/src/lib/settings/settingsTransfer.ts
@@ -202,6 +202,7 @@ const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readon
"autoSelectActiveSidebarNode",
"sidebarPinDefaultDatabase",
"sidebarBrowseObjectsOnDatabaseActivation",
+ "sidebarExpandTreeOnConnect",
"openTabsRestoreMode",
"autoReloadRestoredDataTabsOnOpen",
"disconnectTabHandlingMode",
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts
index 6bcd580f48..d5edfea88b 100644
--- a/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts
+++ b/apps/desktop/src/stores/__tests__/connectionStore.databaseInfo.spec.ts
@@ -276,6 +276,8 @@ describe("connectionStore database info", () => {
const { useConnectionStore } = await import("@/stores/connectionStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
+ // 用例依赖连接节点自动展开后的树结构;#13302 把默认改为关闭后需显式开启。
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
const store = useConnectionStore();
useSettingsStore().editorSettings.sidebarObjectDisplay = "simple";
await store.addConnection(config);
@@ -331,6 +333,8 @@ describe("connectionStore database info", () => {
const { useConnectionStore } = await import("@/stores/connectionStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
+ // 用例依赖连接节点自动展开后的树结构;#13302 把默认改为关闭后需显式开启。
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
const store = useConnectionStore();
useSettingsStore().editorSettings.sidebarObjectDisplay = "simple";
await store.addConnection(config);
@@ -386,6 +390,8 @@ describe("connectionStore database info", () => {
const { useConnectionStore } = await import("@/stores/connectionStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
+ // 用例依赖连接节点自动展开后的树结构;#13302 把默认改为关闭后需显式开启。
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
const store = useConnectionStore();
useSettingsStore().editorSettings.sidebarObjectDisplay = "simple";
await store.addConnection(config);
@@ -448,6 +454,8 @@ describe("connectionStore database info", () => {
const { useConnectionStore } = await import("@/stores/connectionStore");
const { useSettingsStore } = await import("@/stores/settingsStore");
+ // 用例依赖连接节点自动展开后的树结构;#13302 把默认改为关闭后需显式开启。
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
const store = useConnectionStore();
useSettingsStore().editorSettings.sidebarObjectDisplay = "simple";
await store.addConnection(config);
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts
index baad8226ba..724c6ff166 100644
--- a/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts
+++ b/apps/desktop/src/stores/__tests__/connectionStore.metadataLoading.spec.ts
@@ -606,6 +606,9 @@ describe("connectionStore metadata loading", () => {
}, 10_000);
it("does not collapse a connection whose normal root load is already in flight", async () => {
+ // 用例覆盖「连接后自动展开」路径;#13302 把默认改为关闭后需显式开启。
+ const { useSettingsStore } = await import("@/stores/settingsStore");
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
let resolveDatabases!: (databases: Array<{ name: string; comment: null }>) => void;
let markListStarted!: () => void;
const listStarted = new Promise<void>((resolve) => {
@@ -3154,6 +3157,9 @@ describe("connectionStore metadata loading", () => {
});
it("finishes an expanding database when the connection refresh adds siblings", async () => {
+ // 用例覆盖「连接后自动展开」路径;#13302 把默认改为关闭后需显式开启。
+ const { useSettingsStore } = await import("@/stores/settingsStore");
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
let resolveSchemas!: (schemas: { name: string; comment: null }[]) => void;
const listSchemaInfos = vi.fn(
() =>
@@ -5031,6 +5037,9 @@ describe("connectionStore metadata loading", () => {
});
it("expands the catalogless default database on open and refreshes it after saving a schema filter", async () => {
+ // 用例覆盖「连接后自动展开」路径;#13302 把默认改为关闭后需显式开启。
+ const { useSettingsStore } = await import("@/stores/settingsStore");
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
const listDatabases = vi.fn().mockResolvedValue([]);
const listSchemaInfos = vi.fn().mockResolvedValue([{ name: "APP_USER" }, { name: "APP_USER_ARCHIVE" }, { name: "SYS" }]);
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts
index 866be04177..e08722f379 100644
--- a/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts
+++ b/apps/desktop/src/stores/__tests__/connectionStore.mq.spec.ts
@@ -64,6 +64,9 @@ describe("connectionStore MQ sidebar tree", () => {
});
it("loads Pulsar tenants under a message queue connection", async () => {
+ // 用例覆盖「连接后自动展开」路径;#13302 把默认改为关闭后需显式开启。
+ const { useSettingsStore } = await import("@/stores/settingsStore");
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
const mqListTenants = vi.fn().mockResolvedValue([
{ name: "public", adminRoles: [], allowedClusters: [] },
{ name: "tenant-a", adminRoles: [], allowedClusters: [] },
diff --git a/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts b/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts
index f3b02dc811..faac77008f 100644
--- a/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts
+++ b/apps/desktop/src/stores/__tests__/connectionStore.timeout.spec.ts
@@ -851,6 +851,10 @@ describe("connectionStore timeout recovery", () => {
},
];
+ // 用例断言加载完成后连接节点自动展开;#13302 把该行为改为默认关闭,需在此显式开启。
+ const { useSettingsStore } = await import("@/stores/settingsStore");
+ useSettingsStore().editorSettings.sidebarExpandTreeOnConnect = true;
+
void store.loadDatabases(connection.id).catch(() => undefined);
await vi.advanceTimersByTimeAsync(1);
expect(connectDb).toHaveBeenCalledTimes(1);
diff --git a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
index 74422d6722..ac5723ea86 100644
--- a/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
+++ b/apps/desktop/src/stores/__tests__/settingsStore.spec.ts
@@ -1298,6 +1298,25 @@ describe("normalizeEditorSettings - sidebarPinDefaultDatabase", () => {
});
});
+// #13302:连接后是否自动展开对象树的开关。默认必须为 false——模式多的库
+// 全量自动展开是反馈的卡顿来源,升级后的老用户也走新默认。
+describe("normalizeEditorSettings - sidebarExpandTreeOnConnect", () => {
+ it("defaults sidebarExpandTreeOnConnect to false", () => {
+ expect(normalizeEditorSettings({}).sidebarExpandTreeOnConnect).toBe(false);
+ });
+
+ it("preserves explicit boolean values", () => {
+ expect(normalizeEditorSettings({ sidebarExpandTreeOnConnect: true }).sidebarExpandTreeOnConnect).toBe(true);
+ expect(normalizeEditorSettings({ sidebarExpandTreeOnConnect: false }).sidebarExpandTreeOnConnect).toBe(false);
+ });
+
+ it("falls back to default for non-boolean values", () => {
+ expect(normalizeEditorSettings({ sidebarExpandTreeOnConnect: "true" } as any).sidebarExpandTreeOnConnect).toBe(false);
+ expect(normalizeEditorSettings({ sidebarExpandTreeOnConnect: undefined } as any).sidebarExpandTreeOnConnect).toBe(false);
+ expect(normalizeEditorSettings({ sidebarExpandTreeOnConnect: 1 } as any).sidebarExpandTreeOnConnect).toBe(false);
+ });
+});
+
describe("normalizeEditorSettings - preferredExportPath", () => {
it("defaults preferredExportPath to empty string", () => {
expect(normalizeEditorSettings({}).preferredExportPath).toBe("");
diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts
index 379feb91b3..a9cf1c2f4c 100644
--- a/apps/desktop/src/stores/connectionStore.ts
+++ b/apps/desktop/src/stores/connectionStore.ts
@@ -3481,6 +3481,15 @@ export const useConnectionStore = defineStore("connection", () => {
.finally(() => staleTreeRefreshIds.delete(liveNode.id));
}
+ /**
+ * 「连接后自动展开对象树」开关(#13302):关闭时连接/数据库节点加载完成后不再强制展开,
+ * 默认关闭以避免模式多的库全量展开造成的元数据请求与渲染开销。手动展开不受影响:
+ * 用户点击节点时 UI 已先置位 isExpanded,这里的 gating 只拦「加载完成后代为展开」的路径。
+ */
+ function sidebarAutoExpandTreeOnConnect(): boolean {
+ return useSettingsStore().editorSettings.sidebarExpandTreeOnConnect;
+ }
+
// The metadata tree cache must not persist UI state. isExpanded flags written
// while a schema was expanded would replay that expansion on every cache hit
// (a manual collapse never rewrites the cache), so opening a connection would
@@ -3527,7 +3536,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
const normalizedChildren = sortSidebarTreeChildrenForParent(targetNode, childrenWithLinkedServers, config?.db_type);
setChildren(targetNode, targetNode.type === "connection" && targetNode.connectionId ? withSavedSqlRoot(targetNode.connectionId, normalizedChildren, targetNode) : normalizedChildren);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
logMetadataLoadTrace(metadataTraceLogger, trace, "cache-hit", {
cacheStatus: decoded.isStale ? "stale" : "hit",
resultCount: normalizedChildren.length,
@@ -5044,7 +5053,7 @@ export const useConnectionStore = defineStore("connection", () => {
// Schema loading records its own error on the node; keep the database list usable.
}
const liveNode = findNode(treeNodes.value, defaultNodeId);
- if (liveNode) liveNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect() && liveNode) liveNode.isExpanded = true;
}
async function reloadSchemaChildren(connectionId: string, database?: string) {
@@ -5986,7 +5995,7 @@ export const useConnectionStore = defineStore("connection", () => {
const children = buildXuguTablespaceChildren(targetNode, tablespaces);
setChildren(targetNode, children);
targetNode.objectCount = children.length;
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
} catch (error) {
// Storage metadata is an optional, read-only enhancement. A user
// without SYS_* view access should see an empty group rather than a
@@ -5996,7 +6005,7 @@ export const useConnectionStore = defineStore("connection", () => {
if (targetNode) {
setChildren(targetNode, []);
targetNode.objectCount = 0;
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
}
} finally {
finishTreeNodeLoad(load);
@@ -6194,7 +6203,7 @@ export const useConnectionStore = defineStore("connection", () => {
}
}
const liveNode = treeNodeLoadTarget(load);
- if (liveNode) liveNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect() && liveNode) liveNode.isExpanded = true;
if (options?.force) void loadSidebarDatabaseStorage(connectionId, { force: true });
} catch (e) {
recordMetadataLoadError(connectionId, e, load);
@@ -6270,7 +6279,7 @@ export const useConnectionStore = defineStore("connection", () => {
// reveal the rest on demand, unless the user explicitly asked to see all.
const { visible, hasMore } = options?.showAll ? { visible: databaseNodes, hasMore: false } : limitRedisDatabaseList(databaseNodes, useSettingsStore().editorSettings.redisDatabaseDisplayLimit);
setChildren(targetNode, withSavedSqlRoot(connectionId, hasMore ? [...visible, buildLoadMoreNode(targetNode, visible.length, databaseNodes.length - visible.length)] : visible, targetNode));
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6314,7 +6323,7 @@ export const useConnectionStore = defineStore("connection", () => {
);
}
setChildren(targetNode, withSavedSqlRoot(connectionId, children, targetNode));
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6341,7 +6350,7 @@ export const useConnectionStore = defineStore("connection", () => {
targetNode,
),
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6377,7 +6386,7 @@ export const useConnectionStore = defineStore("connection", () => {
targetNode,
),
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6399,7 +6408,7 @@ export const useConnectionStore = defineStore("connection", () => {
isExpanded: false,
};
setChildren(node, [consoleNode]);
- node.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) node.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e);
throw e;
@@ -6448,7 +6457,7 @@ export const useConnectionStore = defineStore("connection", () => {
);
}
const liveNode = treeNodeLoadTarget(load);
- if (liveNode) liveNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect() && liveNode) liveNode.isExpanded = true;
});
}
@@ -6499,7 +6508,7 @@ export const useConnectionStore = defineStore("connection", () => {
});
}
setChildren(targetNode, children);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6563,7 +6572,7 @@ export const useConnectionStore = defineStore("connection", () => {
),
{ trustEmptyConnectionChildren: dbs.length > 0 && visibleDbs.length === 0 },
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e, load);
throw e;
@@ -6599,7 +6608,7 @@ export const useConnectionStore = defineStore("connection", () => {
isExpanded: false,
})),
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e, load);
throw e;
@@ -6677,7 +6686,7 @@ export const useConnectionStore = defineStore("connection", () => {
targetNode,
),
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
} catch (e) {
const targetNode = treeNodeLoadTarget(load);
if (targetNode && getConfig(connectionId)?.db_type === "meilisearch") {
@@ -6700,7 +6709,7 @@ export const useConnectionStore = defineStore("connection", () => {
targetNode,
),
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
}
recordMetadataLoadError(connectionId, e, load);
throw e;
@@ -6731,7 +6740,7 @@ export const useConnectionStore = defineStore("connection", () => {
targetNode,
),
);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6757,7 +6766,7 @@ export const useConnectionStore = defineStore("connection", () => {
const targetNode = treeNodeLoadTarget(load);
if (!targetNode) return;
setChildren(targetNode, isMilvus && database ? collectionChildren : withSavedSqlRoot(connectionId, collectionChildren, targetNode));
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
});
}
@@ -6795,7 +6804,7 @@ export const useConnectionStore = defineStore("connection", () => {
const targetNode = treeNodeLoadTarget(load);
if (!targetNode) return;
setChildren(targetNode, children);
- targetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect()) targetNode.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e, load);
throw e;
@@ -6887,7 +6896,7 @@ export const useConnectionStore = defineStore("connection", () => {
setChildren(targetNode, children);
await savePersistedTreeChildren(cacheKey, children);
const currentTargetNode = treeNodeLoadTarget(load);
- if (currentTargetNode) currentTargetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect() && currentTargetNode) currentTargetNode.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e, load);
throw e;
@@ -6927,7 +6936,7 @@ export const useConnectionStore = defineStore("connection", () => {
setChildren(targetNode, children);
await savePersistedTreeChildren(cacheKey, children);
const currentTargetNode = treeNodeLoadTarget(load);
- if (currentTargetNode) currentTargetNode.isExpanded = true;
+ if (sidebarAutoExpandTreeOnConnect() && currentTargetNode) currentTargetNode.isExpanded = true;
} catch (e) {
recordMetadataLoadError(connectionId, e, load);
throw e;
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index 257ffeadc5..450a596dc4 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -1185,6 +1185,8 @@ export interface EditorSettings {
autoSelectActiveSidebarNode: boolean;
sidebarPinDefaultDatabase: boolean;
sidebarBrowseObjectsOnDatabaseActivation: boolean;
+ /** 连接成功后是否自动展开侧边栏对象树(连接节点/默认数据库节点)。默认关闭:模式多的库全量展开时元数据请求和渲染开销都大(#13302)。 */
+ sidebarExpandTreeOnConnect: boolean;
openQueryOnConnectionOpen: boolean;
sidebarBrowseObjectsOnDatabaseActivationMigrationVersion: number;
openTabsRestoreMode: OpenTabsRestoreMode;
@@ -1550,6 +1552,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
autoSelectActiveSidebarNode: false,
sidebarPinDefaultDatabase: true,
sidebarBrowseObjectsOnDatabaseActivation: false,
+ sidebarExpandTreeOnConnect: false,
openQueryOnConnectionOpen: false,
sidebarBrowseObjectsOnDatabaseActivationMigrationVersion: SIDEBAR_BROWSE_OBJECTS_MIGRATION_VERSION,
openTabsRestoreMode: "all",
@@ -2254,6 +2257,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
sidebarSearchOpenedDatabasesOnly: typeof settings.sidebarSearchOpenedDatabasesOnly === "boolean" ? settings.sidebarSearchOpenedDatabasesOnly : DEFAULT_EDITOR_SETTINGS.sidebarSearchOpenedDatabasesOnly,
autoSelectActiveSidebarNode: settings.autoSelectActiveSidebarNode ?? DEFAULT_EDITOR_SETTINGS.autoSelectActiveSidebarNode,
sidebarPinDefaultDatabase: typeof settings.sidebarPinDefaultDatabase === "boolean" ? settings.sidebarPinDefaultDatabase : DEFAULT_EDITOR_SETTINGS.sidebarPinDefaultDatabase,
+ sidebarExpandTreeOnConnect: typeof settings.sidebarExpandTreeOnConnect === "boolean" ? settings.sidebarExpandTreeOnConnect : DEFAULT_EDITOR_SETTINGS.sidebarExpandTreeOnConnect,
openQueryOnConnectionOpen: typeof settings.openQueryOnConnectionOpen === "boolean" ? settings.openQueryOnConnectionOpen : DEFAULT_EDITOR_SETTINGS.openQueryOnConnectionOpen,
sidebarBrowseObjectsOnDatabaseActivation:
typeof settings.sidebarBrowseObjectsOnDatabaseActivation === "boolean"