From 425a3ff9e4b39f3ce31cc5aaac6563fb77d0ab93 Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 29 Nov 2023 00:23:04 +0400 Subject: [PATCH] UISACQCOMP-170 Optimize acquisition memberships query to improve performance (#735) --- CHANGELOG.md | 1 + lib/AcqUnits/hooks/useAcqRestrictions/useAcqRestrictions.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e36cfa2..40843b44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Added `indexRef` and `inputRef` props to ``. Refs UISACQCOMP-167. * Extend Donors component functionality. Refs UISACQCOMP-168. * Add Donors Filter component. Refs UISACQCOMP-169. +* Optimize acquisition memberships query to improve performance. Refs UISACQCOMP-170. ## [5.0.0](https://github.com/folio-org/stripes-acq-components/tree/v5.0.0) (2023-10-12) [Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v4.0.2...v5.0.0) diff --git a/lib/AcqUnits/hooks/useAcqRestrictions/useAcqRestrictions.js b/lib/AcqUnits/hooks/useAcqRestrictions/useAcqRestrictions.js index f124e698..c1b9e4d2 100644 --- a/lib/AcqUnits/hooks/useAcqRestrictions/useAcqRestrictions.js +++ b/lib/AcqUnits/hooks/useAcqRestrictions/useAcqRestrictions.js @@ -8,10 +8,10 @@ const useAcqMemberships = (entityId, acqUnits = []) => { const stripes = useStripes(); const userId = stripes.user?.user?.id; - const acqUnitsQuery = acqUnits.map(id => `acquisitionsUnitId=${id}`).join(' or '); + const acqUnitsQuery = acqUnits.map(id => `acquisitionsUnitId==${id}`).join(' or '); const searchParams = { limit: LIMIT_MAX, - query: `userId=${userId} and (${acqUnitsQuery})`, + query: `userId==${userId} and (${acqUnitsQuery})`, }; const { data = {}, isFetching } = useQuery(