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

@ -87,9 +87,18 @@ const AlbumListRoute = () => {
[albumListFilter, customFilters, handlePlayQueueAdd, itemCount, server],
);
const providerValue = useMemo(() => {
return {
customFilters,
handlePlay,
id: albumArtistId ?? undefined,
pageKey,
};
}, [albumArtistId, customFilters, handlePlay, pageKey]);
return (
<AnimatedPage>
<ListContext.Provider value={{ customFilters, handlePlay, id: albumArtistId, pageKey }}>
<ListContext.Provider value={providerValue}>
<AlbumListHeader
gridRef={gridRef}
itemCount={itemCount}