Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UISACQCOMP-215: ECS - Add isLoading prop for holdings #809

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/ConsortiumFieldInventory/ConsortiumFieldInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
8 changes: 5 additions & 3 deletions lib/FieldHolding/FieldHolding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand All @@ -64,7 +65,7 @@ export const FieldHolding = ({

setSelectedLocation(location);
}
}, []);
}, [initialHoldingId, locationFieldName, locationsMap, values]);

useEffect(() => {
const isInitialAffiliation = tenantId === initialTenantId;
Expand Down Expand Up @@ -120,7 +121,7 @@ export const FieldHolding = ({

const isLookupTriggerVisible = !(isDisabled || isNonInteractive);

if (isLoading) return <Loading />;
if (isLoading || isHoldingsLoading) return <Loading />;

return (
selectedLocation
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions lib/FieldInventory/FieldInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const FieldInventory = ({
filterHoldings,
filterLocations,
instanceId,
isLoading = false,
isNonInteractive,
locations,
locationIds,
Expand All @@ -35,6 +36,7 @@ export const FieldInventory = ({
locationLabelId={locationLabelId}
name={holdingName}
isDisabled={disabled}
isLoading={isLoading}
isNonInteractive={isNonInteractive}
onChange={onChange}
required={required}
Expand Down Expand Up @@ -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,
Expand Down
Loading