From 0fd3c5ffced12df7eba28f15d842ca77bea7a714 Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Fri, 30 Aug 2024 16:49:03 +0500 Subject: [PATCH 1/3] add `isLoading` prop for holdings --- lib/ConsortiumFieldInventory/ConsortiumFieldInventory.js | 1 + lib/FieldHolding/FieldHolding.js | 6 ++++-- lib/FieldInventory/FieldInventory.js | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.js b/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.js index ef686fc9..a802b064 100644 --- a/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.js +++ b/lib/ConsortiumFieldInventory/ConsortiumFieldInventory.js @@ -119,6 +119,7 @@ ConsortiumFieldInventory.propTypes = { filterLocations: PropTypes.func, holdingName: PropTypes.string.isRequired, isNonInteractive: PropTypes.bool, + isLoading: PropTypes.bool, labelless: PropTypes.bool, locationName: PropTypes.string.isRequired, locations: PropTypes.arrayOf(PropTypes.shape({ diff --git a/lib/FieldHolding/FieldHolding.js b/lib/FieldHolding/FieldHolding.js index 8a89dbd0..87d7228c 100644 --- a/lib/FieldHolding/FieldHolding.js +++ b/lib/FieldHolding/FieldHolding.js @@ -35,12 +35,13 @@ export const FieldHolding = ({ name, onChange, isDisabled = false, + isLoading = false, isNonInteractive = false, required = false, tenantId, }) => { const { - isLoading, + isLoading: isHoldingsLoading, holdings, } = useInstanceHoldings(instanceId, { tenantId }); @@ -120,7 +121,7 @@ export const FieldHolding = ({ const isLookupTriggerVisible = !(isDisabled || isNonInteractive); - if (isLoading) return ; + if (isLoading || isHoldingsLoading) return ; return ( selectedLocation @@ -172,6 +173,7 @@ FieldHolding.propTypes = { filterLocations: PropTypes.func, instanceId: PropTypes.string.isRequired, isDisabled: PropTypes.bool, + isLoading: PropTypes.bool, isNonInteractive: PropTypes.bool, labelId: PropTypes.string, locationFieldName: PropTypes.string.isRequired, diff --git a/lib/FieldInventory/FieldInventory.js b/lib/FieldInventory/FieldInventory.js index 6d48c619..7fdfceea 100644 --- a/lib/FieldInventory/FieldInventory.js +++ b/lib/FieldInventory/FieldInventory.js @@ -9,6 +9,7 @@ export const FieldInventory = ({ filterHoldings, filterLocations, instanceId, + isLoading = false, isNonInteractive, locations, locationIds, @@ -35,6 +36,7 @@ export const FieldInventory = ({ locationLabelId={locationLabelId} name={holdingName} isDisabled={disabled} + isLoading={isLoading} isNonInteractive={isNonInteractive} onChange={onChange} required={required} @@ -77,6 +79,7 @@ FieldInventory.propTypes = { filterHoldings: PropTypes.func, filterLocations: PropTypes.func, + isLoading: PropTypes.bool, isNonInteractive: PropTypes.bool, onChange: PropTypes.func.isRequired, required: PropTypes.bool, From 6eca0c6d8e46e6b2397a1a7bfd44fd697df6a393 Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Wed, 4 Sep 2024 11:43:49 +0500 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ada17e0..57b6c31a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ * Support using custom list of tenants when open the locations modal. Refs UISACQCOMP-210. * ECS - Display all consortium tenants in the affiliation selection of the location lookup. Refs UISACQCOMP-202. * Add isMultiSelect prop to DonorsLookup component. Refs UISACQCOMP-212. +* ECS - Add `isLoading` prop for `ConsortiumFieldInventory` component. Refs UISACQCOMP-215. ## [5.1.1](https://github.com/folio-org/stripes-acq-components/tree/v5.1.1) (2024-04-22) [Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v5.1.0...v5.1.1) From 89a360bc7834050da15dfbc48deabacb0f91197d Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Wed, 4 Sep 2024 11:51:41 +0500 Subject: [PATCH 3/3] fix: linter warning issue --- lib/FieldHolding/FieldHolding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FieldHolding/FieldHolding.js b/lib/FieldHolding/FieldHolding.js index 87d7228c..13e85cc1 100644 --- a/lib/FieldHolding/FieldHolding.js +++ b/lib/FieldHolding/FieldHolding.js @@ -65,7 +65,7 @@ export const FieldHolding = ({ setSelectedLocation(location); } - }, []); + }, [initialHoldingId, locationFieldName, locationsMap, values]); useEffect(() => { const isInitialAffiliation = tenantId === initialTenantId;