mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-08 05:31:39 +00:00
Memoize context values
This commit is contained in:
parent
1111fd00a1
commit
e542fcb8aa
4 changed files with 36 additions and 8 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue