From 611cbc6dd9719c419e8f39b2c375f3762206b881 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Sun, 21 May 2023 20:51:52 -0700 Subject: [PATCH] Fix search results being capped to window height --- .../features/search/components/search-content.tsx | 12 ++---------- src/renderer/features/search/routes/search-route.tsx | 7 +++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/renderer/features/search/components/search-content.tsx b/src/renderer/features/search/components/search-content.tsx index 9007f208..522986dd 100644 --- a/src/renderer/features/search/components/search-content.tsx +++ b/src/renderer/features/search/components/search-content.tsx @@ -1,3 +1,4 @@ +import { MutableRefObject, useMemo, useCallback } from 'react'; import { ColDef, GridReadyEvent, @@ -6,7 +7,7 @@ import { } from '@ag-grid-community/core'; import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact'; import { Stack } from '@mantine/core'; -import { MutableRefObject, useMemo, useCallback } from 'react'; +import { generatePath, useNavigate } from 'react-router'; import { useParams, useSearchParams } from 'react-router-dom'; import { LibraryItem, QueueSong } from '/@/renderer/api/types'; import { VirtualGridAutoSizerContainer } from '/@/renderer/components/virtual-grid'; @@ -18,7 +19,6 @@ import { SONG_CONTEXT_MENU_ITEMS, } from '/@/renderer/features/context-menu/context-menu-items'; import { usePlayQueueAdd } from '/@/renderer/features/player'; -import { generatePath, useNavigate } from 'react-router'; import { AppRoute } from '../../../router/routes'; import { useCurrentServer, @@ -44,8 +44,6 @@ export const SearchContent = ({ tableRef, getDatasource }: SearchContentProps) = const handlePlayQueueAdd = usePlayQueueAdd(); const playButtonBehavior = usePlayButtonBehavior(); - const isPaginationEnabled = true; - const getTable = useCallback( (itemType: string) => { switch (itemType) { @@ -139,17 +137,11 @@ export const SearchContent = ({ tableRef, getDatasource }: SearchContentProps) = }} getRowId={(data) => data.data.id} infiniteInitialRowCount={25} - pagination={isPaginationEnabled} - paginationAutoPageSize={isPaginationEnabled} - paginationPageSize={table.pagination.itemsPerPage || 100} rowBuffer={20} rowHeight={table.rowHeight || 40} rowModelType="infinite" rowSelection="multiple" - // onBodyScrollEnd={handleScroll} onCellContextMenu={handleContextMenu} - // onColumnMoved={handleColumnChange} - // onColumnResized={debouncedColumnChange} onGridReady={onGridReady} onGridSizeChanged={handleGridSizeChange} onRowDoubleClicked={handleRowDoubleClick} diff --git a/src/renderer/features/search/routes/search-route.tsx b/src/renderer/features/search/routes/search-route.tsx index f4e7a46f..6db87a9d 100644 --- a/src/renderer/features/search/routes/search-route.tsx +++ b/src/renderer/features/search/routes/search-route.tsx @@ -66,6 +66,8 @@ const SearchRoute = () => { lastRow = startIndex + numOfItems; } + console.log('lastRow', lastRow); + params.successCallback(items, lastRow); }, }; @@ -111,6 +113,8 @@ const SearchRoute = () => { lastRow = startIndex + numOfItems; } + console.log('lastRow', lastRow); + params.successCallback(items, lastRow); }, }; @@ -155,6 +159,9 @@ const SearchRoute = () => { if (numOfItems < limit) { lastRow = startIndex + numOfItems; } + console.log('items', items); + console.log('numOfItems :>> ', numOfItems); + console.log('lastRow', lastRow); params.successCallback(items, lastRow); },