fix: preload schema options when selector becomes visible (closes #244)

Schema dropdown showed an empty horizontal line because data was loaded
lazily on dropdown open, leaving the Reka UI Select with zero items in
popper mode. Eagerly preload via watchEffect when the schema selector
becomes visible so data is ready before the user opens the dropdown.
This commit is contained in:
t8y2
2026-05-13 16:43:05 +08:00
parent e513c260b5
commit f3c5314636
+8 -1
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed } from "vue";
import { computed, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
import {
Play,
@@ -75,6 +75,13 @@ const activeSchemaOptions = computed(() => {
return getSchemaOptionsForDb(connection.id, schemaDatabaseKey.value);
});
watchEffect(() => {
const connection = props.activeConnection;
if (connection && showSchemaSelector.value && schemaDatabaseKey.value) {
loadSchemaOptions(connection.id, schemaDatabaseKey.value).catch(() => {});
}
});
const isActiveDatabaseDefault = computed(() => isDefaultDatabase(props.activeConnection, activeDatabaseValue.value));
const toolbarStyle = computed(() => {
const color = props.activeConnection?.color;