From f259188549f1be9ee18b6573e312e8ba3a00e473 Mon Sep 17 00:00:00 2001 From: miky41195 Date: Thu, 6 Feb 2025 12:32:42 +0100 Subject: [PATCH 1/2] fix(places): remove floorId param when use Search bar --- src/features/places/screens/PlacesScreen.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/features/places/screens/PlacesScreen.tsx b/src/features/places/screens/PlacesScreen.tsx index 5d7c2a08..86e007ff 100644 --- a/src/features/places/screens/PlacesScreen.tsx +++ b/src/features/places/screens/PlacesScreen.tsx @@ -102,7 +102,6 @@ export const PlacesScreen = ({ navigation, route }: Props) => { const { data: places, isLoading: isLoadingPlaces } = useSearchPlaces({ siteId: campus?.id, search: debouncedSearch, - floorId, categoryId, subCategoryId, }); From 4131d1aa2c52710de6c65cbf5fd2a24952164502 Mon Sep 17 00:00:00 2001 From: miky41195 Date: Thu, 6 Feb 2025 16:40:27 +0100 Subject: [PATCH 2/2] fix(places): fix get places --- src/core/queries/placesHooks.ts | 3 --- src/features/places/hooks/useSearchPlaces.ts | 4 ++-- src/features/places/screens/PlacesScreen.tsx | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/queries/placesHooks.ts b/src/core/queries/placesHooks.ts index ad023c7d..c463bb35 100644 --- a/src/core/queries/placesHooks.ts +++ b/src/core/queries/placesHooks.ts @@ -72,9 +72,6 @@ export const useGetSite = (siteId?: string) => { export const useGetPlaces = (params: GetPlacesRequest) => { const placesClient = usePlacesClient(); - if (!params.search) { - delete params.search; - } const key = [PLACES_QUERY_KEY, JSON.stringify(params)]; return useQuery(key, () => placesClient.getPlaces(params), { diff --git a/src/features/places/hooks/useSearchPlaces.ts b/src/features/places/hooks/useSearchPlaces.ts index 9c7d7d85..ffc99bdd 100644 --- a/src/features/places/hooks/useSearchPlaces.ts +++ b/src/features/places/hooks/useSearchPlaces.ts @@ -28,9 +28,9 @@ export const useSearchPlaces = ({ placeSubCategoryId: subCategoryId ? [subCategoryId] : undefined, }); const placesQuery = useGetPlaces({ - search, + search: search || undefined, siteId, - floorId, + floorId: search ? undefined : floorId, placeCategoryId: categoryId, placeSubCategoryId: subCategoryId ? [subCategoryId] : undefined, }); diff --git a/src/features/places/screens/PlacesScreen.tsx b/src/features/places/screens/PlacesScreen.tsx index 86e007ff..5d7c2a08 100644 --- a/src/features/places/screens/PlacesScreen.tsx +++ b/src/features/places/screens/PlacesScreen.tsx @@ -102,6 +102,7 @@ export const PlacesScreen = ({ navigation, route }: Props) => { const { data: places, isLoading: isLoadingPlaces } = useSearchPlaces({ siteId: campus?.id, search: debouncedSearch, + floorId, categoryId, subCategoryId, });