From 1d5839eb709556a9cb747380dd0f1426a895cb56 Mon Sep 17 00:00:00 2001 From: Sayaka Ono Date: Thu, 5 Dec 2024 17:55:36 -0800 Subject: [PATCH] LF-4558 Improve animalsExistOnFarm logic --- .../src/containers/Animals/Inventory/useAnimalsExist.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webapp/src/containers/Animals/Inventory/useAnimalsExist.tsx b/packages/webapp/src/containers/Animals/Inventory/useAnimalsExist.tsx index 6892c743ae..cee342be60 100644 --- a/packages/webapp/src/containers/Animals/Inventory/useAnimalsExist.tsx +++ b/packages/webapp/src/containers/Animals/Inventory/useAnimalsExist.tsx @@ -18,12 +18,12 @@ import useQueries from '../../../hooks/api/useQueries'; const useAnimalsExist = () => { const { data, isLoading } = useQueries([ { label: 'animals', hook: useGetAnimalsQuery }, - { label: 'batches', hook: useGetAnimalBatchesQuery }, + { label: 'animalBatches', hook: useGetAnimalBatchesQuery }, ]); const animalsExistOnFarm = !isLoading && - [...data.animals, ...data.batches].filter((entity) => !entity.animal_removal_reason_id).length; + [...data.animals, ...data.animalBatches].some((entity) => !entity.animal_removal_reason_id); return { animalsExistOnFarm }; };