fix(grid): preserve column filters on refresh
This commit is contained in:
parent
f7f39f124c
commit
12a1032e1b
|
|
@ -1147,8 +1147,21 @@ function onScrollerScroll(e: Event) {
|
|||
|
||||
initColumnWidths();
|
||||
watch(() => visibleColumns.value.length, initColumnWidths);
|
||||
const localFilterScopeKey = computed(() =>
|
||||
[
|
||||
props.connectionId ?? "",
|
||||
props.database ?? "",
|
||||
props.schema ?? "",
|
||||
props.context ?? "",
|
||||
props.tableMeta?.schema ?? "",
|
||||
props.tableMeta?.tableName ?? "",
|
||||
props.tableMeta ? "" : (props.sql ?? ""),
|
||||
props.result.columns.join("\0"),
|
||||
(props.sourceColumns ?? []).map((column) => column ?? "").join("\0"),
|
||||
].join("\u0001"),
|
||||
);
|
||||
watch(
|
||||
() => props.result,
|
||||
() => localFilterScopeKey.value,
|
||||
() => {
|
||||
localColumnFilters.value = {};
|
||||
hiddenColumnIndexes.value = new Set();
|
||||
|
|
|
|||
|
|
@ -17,3 +17,8 @@ test("rollback refresh preserves header sort order", () => {
|
|||
assert.match(match[1], /currentOrderBy\(\)/);
|
||||
assert.doesNotMatch(match[1], /orderByInput\.value\.trim\(\) \|\| undefined/);
|
||||
});
|
||||
|
||||
test("data result refresh preserves local column filters", () => {
|
||||
assert.doesNotMatch(source, /watch\(\s*\(\)\s*=>\s*props\.result,[\s\S]*?localColumnFilters\.value\s*=\s*\{\}/);
|
||||
assert.match(source, /localFilterScopeKey/);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue