Skip to content

Commit

Permalink
add isLoading prop for holdings
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Aug 30, 2024
1 parent 60b4433 commit 0fd3c5f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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
6 changes: 4 additions & 2 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 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

0 comments on commit 0fd3c5f

Please sign in to comment.