Memoize context values

This commit is contained in:
jeffvli 2023-08-08 00:38:32 -07:00
parent 1111fd00a1
commit e542fcb8aa
4 changed files with 36 additions and 8 deletions

View file

@ -1,5 +1,5 @@
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
import { useRef } from 'react';
import { useMemo, useRef } from 'react';
import { useCurrentServer } from '../../../store/auth.store';
import { useListFilterByKey } from '../../../store/list.store';
import { LibraryItem } from '/@/renderer/api/types';
@ -36,9 +36,16 @@ const AlbumArtistListRoute = () => {
? undefined
: itemCountCheck.data?.totalRecordCount;
const providerValue = useMemo(() => {
return {
id: undefined,
pageKey,
};
}, [pageKey]);
return (
<AnimatedPage>
<ListContext.Provider value={{ id: undefined, pageKey }}>
<ListContext.Provider value={providerValue}>
<AlbumArtistListHeader
gridRef={gridRef}
itemCount={itemCount}