From e0633ee5eca6ff6cc4f35f4850dce8f637a1984f Mon Sep 17 00:00:00 2001 From: heswell Date: Wed, 24 Jan 2024 10:41:45 +0000 Subject: [PATCH] fix issue with page down when running with vuu server data --- .../vuu-table/src/useKeyboardNavigation.ts | 14 ++++++++++++-- .../feature-filter-table/src/useFilterTable.tsx | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/vuu-ui/packages/vuu-table/src/useKeyboardNavigation.ts b/vuu-ui/packages/vuu-table/src/useKeyboardNavigation.ts index b233307483..d7e8eed8b9 100644 --- a/vuu-ui/packages/vuu-table/src/useKeyboardNavigation.ts +++ b/vuu-ui/packages/vuu-table/src/useKeyboardNavigation.ts @@ -247,9 +247,19 @@ NavigationHookProps) => { break; } } - requestAnimationFrame(() => { + // Introduce a delay to allow the scroll operation to complete, + // which will trigger a range reset and rerender of rows. We + // might need to tweak how this works. If we introduce too big + // a delay, we risk seeing the newly rendered rows, with the focus + // still on the old cell, which will be apparent as a brief flash + // of the old cell focus before switching to correct cell. If we were + // to change the way re assign keys such that we can guarantee that + // when we page down, rows in same position get same keys, then same + // cell would be focussed in new page as previous and issue would not + // arise. + setTimeout(() => { resolve([newRowIdx, colIdx]); - }); + }, 35); }), [requestScroll, rowCount, viewportRowCount] ); diff --git a/vuu-ui/sample-apps/feature-filter-table/src/useFilterTable.tsx b/vuu-ui/sample-apps/feature-filter-table/src/useFilterTable.tsx index cc75d9ec06..7ecdd48b96 100644 --- a/vuu-ui/sample-apps/feature-filter-table/src/useFilterTable.tsx +++ b/vuu-ui/sample-apps/feature-filter-table/src/useFilterTable.tsx @@ -176,8 +176,7 @@ export const useFilterTable = ({ tableSchema }: FilterTableFeatureProps) => { onAvailableColumnsChange: handleAvailableColumnsChange, onConfigChange: handleTableConfigChange, onFeatureInvocation: handleVuuFeatureInvoked, - // renderBufferSize: 50, - renderBufferSize: 0, + renderBufferSize: 10, }; // It is important that these values are not assigned in advance. They