From 10efdfba64d59919eff26fa89fd14aa946c1fe6d Mon Sep 17 00:00:00 2001 From: MoizAdnan Date: Wed, 14 Aug 2024 12:10:46 +0500 Subject: [PATCH] chore: Refactor AddEditLocationModal to improve code readability and maintainability --- .../admin/components/locations/AddEditLocationModal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx b/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx index 0d08c30bcd..f1dab4177a 100644 --- a/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx +++ b/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx @@ -61,7 +61,13 @@ export default function AddEditLocationModal(props: { location?: LocationType; s const locationID = useHookstate(props.location?.id || null) - const locationQuery = useFind(locationPath, { query: { id: locationID.value } }) + const params = { + query: { + id: locationID.value + } + } + + const locationQuery = useFind(locationPath, locationID.value ? params : undefined) const location = locationID.value ? locationQuery.data[0] : undefined const locationMutation = useMutation(locationPath)