Skip to content

Commit

Permalink
Merge branch 'master' into UIIN-3124
Browse files Browse the repository at this point in the history
  • Loading branch information
zburke authored Nov 13, 2024
2 parents a432b40 + db50c79 commit 03f3a86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Run `history.replace` once during component mount and update to avoid URL rewriting. Refs UIIN-3099.
* ECS | "FOLIO/MARC-shared" source is displayed in manually shared instance record. Fixes UIIN-3115.
* Allow user to move item to another holdings associated with another instance. Fixes UIIN-3102.
* ECS | Instance details pane does not contain all tenants when user does not have affiliations / permissions in all tenants. Fixes UIIN-3113.
* Cautiously evaluate tenant permissions to avoid NPEs. Refs UIIN-3124.

## [12.0.0](https://github.com/folio-org/ui-inventory/tree/v12.0.0) (2024-10-31)
Expand Down
12 changes: 8 additions & 4 deletions src/hooks/useMemberTenantHoldings/useMemberTenantHoldings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ const useMemberTenantHoldings = (instance, tenantId, userTenantPermissions) => {
const { holdingsRecords: expandedHoldings, isLoading: isExpandedHoldingsLoading } = useInstanceHoldingsQuery(instance?.id, { tenantId, enabled: canViewHoldings });
const { holdings: limitedHoldings, isLoading: isLimitedHoldingsLoading } = useConsortiumHoldings(instance?.id, tenantId, { enabled: !canViewHoldings });

const holdings = useMemo(() => expandedHoldings || limitedHoldings || [],
[expandedHoldings, limitedHoldings, isExpandedHoldingsLoading, isLimitedHoldingsLoading]);
const isLoading = useMemo(() => isExpandedHoldingsLoading || isLimitedHoldingsLoading,
[isExpandedHoldingsLoading, isLimitedHoldingsLoading]);
const holdings = useMemo(
() => (expandedHoldings?.length ? expandedHoldings : limitedHoldings?.length ? limitedHoldings : []),
[expandedHoldings, limitedHoldings, isExpandedHoldingsLoading, isLimitedHoldingsLoading],
);
const isLoading = useMemo(
() => isExpandedHoldingsLoading || isLimitedHoldingsLoading,
[isExpandedHoldingsLoading, isLimitedHoldingsLoading],
);

return {
holdings,
Expand Down

0 comments on commit 03f3a86

Please sign in to comment.