fix(grid): remove virtual row memoization

This commit is contained in:
t8y2 committed 2026-05-23 08:58:18 +08:00
1 parent 370701a82b
commit f68edb2516
5 files changed
+89 -77

No files matched your search

@@ -11,6 +11,21 @@ test("toolbar refresh preserves header sort order", () => {
assert.doesNotMatch(match[1], /orderByInput\.value\.trim\(\) \|\| undefined/);
});
test("header sort starts from first page and top row", () => {
const match = source.match(/function toggleSort\(colName: string, colIdx: number\) \{([\s\S]*?)\n\}/);
assert.ok(match, "DataGrid should define toggleSort");
assert.match(match[1], /orderByInput\.value = ""/);
assert.match(match[1], /currentPage\.value = 1/);
assert.match(match[1], /resetGridVerticalScroll\(true\)/);
});
test("visible row numbers use display index after sorting", () => {
assert.match(source, /displayIndex: number/);
assert.match(source, /\.map\(\(item, displayIndex\) => \(\{ \.\.\.item, displayIndex \}\)\)/);
assert.match(source, /<template #default="\{ item \}">/);
assert.match(source, /\{\{ item\.displayIndex \+ 1 \}\}/);
});
test("rollback refresh preserves header sort order", () => {
const match = source.match(/function onToolbarRollback\(\) \{([\s\S]*?)\n\}/);
assert.ok(match, "DataGrid should define onToolbarRollback");
@@ -4,11 +4,8 @@ import test from "node:test";
const source = readFileSync("apps/desktop/src/components/grid/DataGrid.vue", "utf8");
test("data grid memoizes virtual rows with render-affecting dependencies", () => {
assert.match(source, /function rowRenderMemoDeps\(item: RowItem, index: number\)/);
assert.match(source, /function rowSelectionMemoKey\(item: RowItem, index: number\)/);
assert.match(source, /function rowSearchMemoKey\(index: number\)/);
assert.match(source, /function rowHoverMemoKey\(index: number\)/);
assert.match(source, /const columnFormatterMemoKey = computed/);
assert.match(source, /v-memo="rowRenderMemoDeps\(item, index\)"/);
test("data grid does not memoize virtual rows", () => {
assert.doesNotMatch(source, /v-memo=/);
assert.doesNotMatch(source, /function rowRenderMemoDeps/);
assert.match(source, /\{\{ item\.displayIndex \+ 1 \}\}/);
});