mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-21 05:10:26 +00:00
fix(grid): initialize filter state before preview watcher
This commit is contained in:
@@ -521,6 +521,10 @@ const columnTypeMap = computed(() => {
|
||||
});
|
||||
const resolvedConnectionConfig = computed(() => connectionStore.getConfig(props.connectionId ?? ""));
|
||||
const resolvedDatabaseType = computed(() => props.databaseType ?? effectiveDatabaseTypeForConnection(resolvedConnectionConfig.value));
|
||||
const isResultsContext = computed(() => props.context === "results");
|
||||
const canShowWhereSearch = computed(() => !!props.onExecuteSql && !isResultsContext.value && resolvedDatabaseType.value !== "victoriametrics");
|
||||
const canUseWhereSearch = computed(() => !!props.tableMeta && canShowWhereSearch.value);
|
||||
const canUseServerColumnFilter = computed(() => canUseWhereSearch.value && !!props.connectionId && !!props.tableMeta);
|
||||
const tableStructureCapabilities = computed(() => getTableStructureCapabilities(resolvedDatabaseType.value, resolvedConnectionConfig.value?.db_type));
|
||||
|
||||
const columnCommentMap = computed(() => {
|
||||
@@ -2780,7 +2784,6 @@ const manualTotalRowCount = ref<number | undefined>(undefined);
|
||||
const manualTotalRowCountLoading = ref(false);
|
||||
const showTruncationWarning = computed(() => props.result.truncated === true && typeof props.pageLimit !== "number" && props.result.has_more !== true);
|
||||
const truncationHintKey = computed(() => dataGridTruncationHintKey(resolvedDatabaseType.value));
|
||||
const isResultsContext = computed(() => props.context === "results");
|
||||
// affected_rows reported by the backend can be larger than the rows we
|
||||
// actually have in memory — e.g. ES auto-pages SELECT * on a big index and
|
||||
// reports the index's true match count. Surface that in the status bar so
|
||||
@@ -2916,9 +2919,6 @@ watch(
|
||||
const showQueryEditReadOnlyBadge = computed(() => isResultsContext.value && hasData.value && !props.editable && !!props.queryEditabilityReason);
|
||||
const queryEditReadOnlyReason = computed(() => (props.queryEditabilityReason ? t(`grid.queryEditUnsupported.${props.queryEditabilityReason}`) : ""));
|
||||
const showKeylessEditWarning = computed(() => !!props.editable && !!props.tableMeta && canUseKeylessRowPredicate(props.databaseType, props.tableMeta.primaryKeys ?? []));
|
||||
const canShowWhereSearch = computed(() => !!props.onExecuteSql && !isResultsContext.value && resolvedDatabaseType.value !== "victoriametrics");
|
||||
const canUseWhereSearch = computed(() => !!props.tableMeta && canShowWhereSearch.value);
|
||||
const canUseServerColumnFilter = computed(() => canUseWhereSearch.value && !!props.connectionId && !!props.tableMeta);
|
||||
type DataGridTableMeta = NonNullable<typeof props.tableMeta>;
|
||||
const hiveTableTransactional = ref<boolean | undefined>(undefined);
|
||||
const resultSourceColumns = computed(() => props.result.columns.map((column, index) => props.sourceColumns?.[index] ?? column));
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const dataGridSource = readFileSync(new URL("../DataGrid.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("DataGrid setup initialization order", () => {
|
||||
it("initializes where-search capability before the immediate filter preview watcher", () => {
|
||||
const canUseWhereSearchDeclaration = dataGridSource.indexOf("const canUseWhereSearch = computed");
|
||||
const filterPreviewDeclaration = dataGridSource.indexOf("const filterPreviewVisible = computed");
|
||||
const filterPreviewWatcher = dataGridSource.indexOf("[filterPreviewVisible, structuredFilterRules]");
|
||||
|
||||
expect(canUseWhereSearchDeclaration).toBeGreaterThanOrEqual(0);
|
||||
expect(filterPreviewDeclaration).toBeGreaterThan(canUseWhereSearchDeclaration);
|
||||
expect(filterPreviewWatcher).toBeGreaterThan(filterPreviewDeclaration);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user