From 99ac673e077ade9107d83dce7c3d18263e0228cf Mon Sep 17 00:00:00 2001 From: Jakz Date: Tue, 23 Apr 2024 08:58:29 +0800 Subject: [PATCH] memoize the search filter --- .../GalleryEditorNftSelector.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/mobile/src/screens/GalleryScreen/GalleryEditorNftSelector.tsx b/apps/mobile/src/screens/GalleryScreen/GalleryEditorNftSelector.tsx index 8f5f0a755c..2956365b23 100644 --- a/apps/mobile/src/screens/GalleryScreen/GalleryEditorNftSelector.tsx +++ b/apps/mobile/src/screens/GalleryScreen/GalleryEditorNftSelector.tsx @@ -1,6 +1,7 @@ import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'; -import { Suspense, useCallback } from 'react'; +import { Suspense, useCallback, useMemo } from 'react'; import { View } from 'react-native'; +import { noop } from 'shared/utils/noop'; import { NftSelectorHeader } from '~/components/NftSelector/NftSelectorHeader'; import { NftSelectorToolbar } from '~/components/NftSelector/NftSelectorToolbar'; @@ -42,6 +43,16 @@ export function GalleryEditorNftSelector() { [navigation, route.params.galleryId] ); + const searchCriteria = useMemo( + () => ({ + searchQuery, + ownerFilter: ownershipTypeFilter, + networkFilter: networkFilter, + sortView, + }), + [searchQuery, ownershipTypeFilter, networkFilter, sortView] + ); + return ( @@ -63,15 +74,10 @@ export function GalleryEditorNftSelector() { }> {}} + onSelectNftGroup={noop} />