From d9fd60bec1dfd40f091d21ff810d6146bdff3205 Mon Sep 17 00:00:00 2001 From: Will Miao Date: Tue, 2 Jun 2026 08:43:30 +0800 Subject: [PATCH] fix(recipe): use VirtualScroller pageSize in reload helpers to prevent pagination offset gap --- static/js/api/recipeApi.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/api/recipeApi.js b/static/js/api/recipeApi.js index 9f135c1b..5cbddc7a 100644 --- a/static/js/api/recipeApi.js +++ b/static/js/api/recipeApi.js @@ -197,8 +197,8 @@ export async function resetAndReloadWithVirtualScroll(options = {}) { // Reset page counter pageState.currentPage = 1; - // Fetch the first page - const result = await fetchPageFunction(1, pageState.pageSize || 50); + const pageSize = state.virtualScroller?.pageSize || pageState.pageSize || 100; + const result = await fetchPageFunction(1, pageSize); // Update the virtual scroller state.virtualScroller.refreshWithData( @@ -251,8 +251,8 @@ export async function loadMoreWithVirtualScroll(options = {}) { pageState.currentPage = 1; } - // Fetch the first page of data - const result = await fetchPageFunction(pageState.currentPage, pageState.pageSize || 50); + const pageSize = state.virtualScroller?.pageSize || pageState.pageSize || 100; + const result = await fetchPageFunction(pageState.currentPage, pageSize); // Update virtual scroller with the new data state.virtualScroller.refreshWithData(