Skip to content

Commit

Permalink
UIIN-3113: ECS | Instance details pane does not contain all tenants w…
Browse files Browse the repository at this point in the history
…hen user does not have affiliations / permissions in all tenants (#2664)
  • Loading branch information
mariia-aloshyna authored Nov 13, 2024
1 parent 317969f commit db50c79
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.

## [12.0.0](https://github.com/folio-org/ui-inventory/tree/v12.0.0) (2024-10-31)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v11.0.5...v12.0.0)
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 db50c79

Please sign in to comment.