From 46c0309c39d5ed0448661dde407ddb112faf8962 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Fri, 3 Jul 2026 00:01:51 +0800 Subject: [PATCH] fix(grid): cover horizontal wheel pagination --- apps/desktop/src/lib/dataGridInfiniteScroll.ts | 1 + packages/app-tests/dataGridInfiniteScroll.test.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/apps/desktop/src/lib/dataGridInfiniteScroll.ts b/apps/desktop/src/lib/dataGridInfiniteScroll.ts index 608e8e1d1f..465cf9e186 100644 --- a/apps/desktop/src/lib/dataGridInfiniteScroll.ts +++ b/apps/desktop/src/lib/dataGridInfiniteScroll.ts @@ -18,6 +18,7 @@ export function dataGridScrollPosition(top: number, left: number): DataGridScrol export function shouldCheckInfiniteScrollAfterScroll(previous: DataGridScrollPosition | undefined, current: DataGridScrollPosition): boolean { if (!previous) return false; + // Shift+wheel horizontal scrolling changes scrollLeft only and must not paginate. return previous.top !== current.top; } diff --git a/packages/app-tests/dataGridInfiniteScroll.test.ts b/packages/app-tests/dataGridInfiniteScroll.test.ts index cbddca08fd..8e69d466ce 100644 --- a/packages/app-tests/dataGridInfiniteScroll.test.ts +++ b/packages/app-tests/dataGridInfiniteScroll.test.ts @@ -6,6 +6,11 @@ test("horizontal-only scroll does not check infinite scroll", () => { assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(240, 0), dataGridScrollPosition(240, 180)), false); }); +test("shift-wheel horizontal scroll near the bottom does not check infinite scroll", () => { + assert.equal(isDataGridNearScrollBottom({ scrollTop: 0, scrollHeight: 80, clientHeight: 120 }), true); + assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(0, 0), dataGridScrollPosition(0, 320)), false); +}); + test("vertical scroll checks infinite scroll even when horizontal offset also changes", () => { assert.equal(shouldCheckInfiniteScrollAfterScroll(dataGridScrollPosition(240, 0), dataGridScrollPosition(360, 180)), true); });