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

UIIN-3160: Decrease the amount of re-renders of ConsortialHoldings component and fix accordion states between instances #2716

Merged
merged 7 commits into from
Jan 28, 2025
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Change import of `exportToCsv` from `stripes-util` to `stripes-components`. Refs UIIN-3025.
* ECS: Disable opening item details if a user is not affiliated with item's member tenant. Fixes UIIN-3187.
* Correctly depend on `inflected`. Refs UIIN-3203.
* Decrease the amount of rerenders in `ConsortialHoldings` component. Fixes UIIN-3196.

## [12.0.12](https://github.com/folio-org/ui-inventory/tree/v12.0.12) (2025-01-27)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v12.0.11...v12.0.12)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ConsortialHoldings = ({
updateStatus({});
updatePrevInstanceId(instanceId);
}
}, [instanceId]);
}, []);

useEffect(() => {
if (typeof isAllExpanded === 'boolean') {
Expand Down Expand Up @@ -91,7 +91,7 @@ const ConsortialHoldings = ({
onRegisterAccordion={onRegisterNewAcc}
>
<Accordion
id="consortialHoldings"
id={`consortialHoldings.${instance?.id}`}
label={<FormattedMessage id="ui-inventory.consortialHoldings" />}
displayWhenClosed={renderExpandAllButton}
displayWhenOpen={renderExpandAllButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const MemberTenantHoldings = ({
return (
<Accordion
className={css.memberTenantHoldings}
id={memberTenantId}
id={`${memberTenantId}.${instance?.id}`}
label={name}
>
<div className={css.memberTenantHoldings}>
Expand Down
2 changes: 0 additions & 2 deletions src/Instance/InstanceDetails/InstanceDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import React, {
import { useIntl, FormattedMessage } from 'react-intl';
import { useLocation } from 'react-router-dom';
import PropTypes from 'prop-types';
import { uniqueId } from 'lodash';

import {
AppIcon,
Expand Down Expand Up @@ -212,7 +211,6 @@ const InstanceDetails = forwardRef(({

{isConsortialHoldingsVisible && (
<ConsortialHoldings
key={uniqueId(instance?.id)}
instance={instance}
prevInstanceId={prevInstanceId.current}
updatePrevInstanceId={updatePrevInstanceId}
Expand Down
Loading