From 2029574fc54f1c4687ada5b165139f2bb8135fd9 Mon Sep 17 00:00:00 2001 From: caoxing Date: Wed, 20 Nov 2024 16:16:00 +0800 Subject: [PATCH] fix: share view lack search relative params --- .../app/blocks/share/view/component/grid/GridViewBase.tsx | 6 ++++-- .../app/blocks/view/search/SearchCountPagination.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/nextjs-app/src/features/app/blocks/share/view/component/grid/GridViewBase.tsx b/apps/nextjs-app/src/features/app/blocks/share/view/component/grid/GridViewBase.tsx index c37dbaf84..d6db55657 100644 --- a/apps/nextjs-app/src/features/app/blocks/share/view/component/grid/GridViewBase.tsx +++ b/apps/nextjs-app/src/features/app/blocks/share/view/component/grid/GridViewBase.tsx @@ -83,7 +83,7 @@ export const GridViewBase = (props: IGridViewProps) => { const hiddenFields = useHiddenFields(); const customIcons = useGridIcons(); const { openTooltip, closeTooltip } = useGridTooltipStore(); - const { setGridRef } = useGridSearchStore(); + const { setGridRef, searchCursor } = useGridSearchStore(); const prepare = isHydrated && view && columns.length; const { filter, sort } = view ?? {}; @@ -126,7 +126,7 @@ export const GridViewBase = (props: IGridViewProps) => { }; }, [filter, sort?.sortObjs, viewQueryWithGroup]); - const { recordMap, groupPoints, onVisibleRegionChanged } = useGridAsyncRecords( + const { recordMap, groupPoints, onVisibleRegionChanged, searchHitIndex } = useGridAsyncRecords( ssrRecords, undefined, viewQuery, @@ -254,6 +254,8 @@ export const GridViewBase = (props: IGridViewProps) => { columnStatistics={columnStatistics} freezeColumnCount={isTouchDevice ? 0 : 1} columns={columns} + searchCursor={searchCursor} + searchHitIndex={searchHitIndex} customIcons={customIcons} rowControls={rowControls} style={{ diff --git a/apps/nextjs-app/src/features/app/blocks/view/search/SearchCountPagination.tsx b/apps/nextjs-app/src/features/app/blocks/view/search/SearchCountPagination.tsx index 508273037..1fb2f60d4 100644 --- a/apps/nextjs-app/src/features/app/blocks/view/search/SearchCountPagination.tsx +++ b/apps/nextjs-app/src/features/app/blocks/view/search/SearchCountPagination.tsx @@ -165,7 +165,7 @@ export const SearchCountPagination = forwardRef< return finalResult; } else { const result = await previousFn(baseQueryRo); - result && + result?.data && result.data?.forEach((result, index) => { const indexNumber = skip + index + 1; finalResult[indexNumber] = result; @@ -191,7 +191,7 @@ export const SearchCountPagination = forwardRef< if (nextCursor <= totalCount) { const skip = currentPage - 1; const result = await nextFn({ ...baseQueryRo, skip }); - result && + result?.data && result.data?.forEach((result, index) => { const indexNumber = skip + index + 1; finalResult[indexNumber] = result;