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-2600: Remove error message after switch from Instance Edit screen to another app #2311

Merged
merged 7 commits into from
Oct 19, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Show facet options, if they exist, after clicking the +More button. Refs UIIN-2533.
* If Shared & Held by facets were selected in the Browse search, then retain them in the Search lookup after clicking the record. Refs UIIN-2608.
* Instance. Series heading has vanished in detailed view. Fixes UIIN-2601.
* Remove error message after switch from Instance Edit screen to another app. Fixes UIIN-2600.

## [10.0.0](https://github.com/folio-org/ui-inventory/tree/v10.0.0) (2023-10-13)
[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v9.4.12...v10.0.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,13 @@ import {
} from '../../../hooks';

const ConsortialHoldings = ({ instance }) => {
const pathToAccordion = ['consortialHoldings', '_state'];
const instanceId = instance?.id;
const prevInstanceId = useRef(instanceId);

const stripes = useStripes();
const prevInstanceId = useRef(instanceId);
const { consortiaTenantsById } = useContext(DataContext);

const { tenants } = useSearchForShadowInstanceTenants({ instanceId });

const memberTenants = tenants
.map(tenant => consortiaTenantsById[tenant.id])
.filter(tenant => !tenant?.isCentral && (tenant?.id !== stripes.okapi.tenant))
.sort((a, b) => a.name.localeCompare(b.name));

const pathToAccordion = ['consortialHoldings', '_state'];
const [isConsortialAccOpen, setConsortialAccOpen] = useHoldingsAccordionState({ instanceId, pathToAccordion });

useEffect(() => {
Expand All @@ -46,6 +39,13 @@ const ConsortialHoldings = ({ instance }) => {
}
}, [instanceId]);

if (!consortiaTenantsById) return null;

const memberTenants = tenants
.map(tenant => consortiaTenantsById[tenant.id])
.filter(tenant => !tenant?.isCentral && (tenant?.id !== stripes.okapi.tenant))
.sort((a, b) => a.name.localeCompare(b.name));

return (
<IfInterface name="consortia">
<Accordion
Expand Down
4 changes: 2 additions & 2 deletions src/edit/InstanceForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ class InstanceForm extends React.Component {
}),
) : [];

const statisticalCodeOptions = referenceTables.statisticalCodes
const statisticalCodeOptions = referenceTables.statisticalCodes ? referenceTables.statisticalCodes
.map(
code => ({
label: refLookup(referenceTables.statisticalCodeTypes, code.statisticalCodeTypeId).name + ': ' + code.code + ' - ' + code.name,
value: code.id,
selected: code.id === initialValues.statisticalCodeId,
})
)
.sort((a, b) => a.label.localeCompare(b.label));
.sort((a, b) => a.label.localeCompare(b.label)) : [];

// Since preceding/succeeding title relationships are split out from other parent/child instances,
// we don't want the type selection box for parent/child to include the preceding-succeeding type
Expand Down