From 045c87862908bfb7c3a1462a306582c2210e8643 Mon Sep 17 00:00:00 2001 From: Oleksandr Hladchenko1 Date: Tue, 17 Oct 2023 13:56:20 +0300 Subject: [PATCH 1/3] UIIN-2600: Remove error message after switch from Instance Edit screen to another app --- CHANGELOG.md | 4 ++++ .../ConsortialHoldings/ConsortialHoldings.js | 2 ++ src/edit/InstanceForm.js | 12 ++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 047214f03..906408003 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change history for ui-inventory +## 10.0.1 IN PROGRESS + +* 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) diff --git a/src/Instance/InstanceDetails/ConsortialHoldings/ConsortialHoldings.js b/src/Instance/InstanceDetails/ConsortialHoldings/ConsortialHoldings.js index d3623b753..9c75e76c6 100644 --- a/src/Instance/InstanceDetails/ConsortialHoldings/ConsortialHoldings.js +++ b/src/Instance/InstanceDetails/ConsortialHoldings/ConsortialHoldings.js @@ -21,6 +21,8 @@ const ConsortialHoldings = ({ instance }) => { const { tenants } = useSearchForShadowInstanceTenants({ instanceId: instance?.id }); + if (!consortiaTenantsById) return null; + const memberTenants = tenants .map(tenant => consortiaTenantsById[tenant.id]) .filter(tenant => !tenant?.isCentral && (tenant?.id !== stripes.okapi.tenant)) diff --git a/src/edit/InstanceForm.js b/src/edit/InstanceForm.js index 7556f02c3..ac1407e15 100644 --- a/src/edit/InstanceForm.js +++ b/src/edit/InstanceForm.js @@ -309,7 +309,7 @@ class InstanceForm extends React.Component { return ref || {}; }; - const instanceTypeOptions = referenceTables.instanceTypes ? referenceTables.instanceTypes.map( + const instanceTypeOptions = referenceTables.instanceTypes ? referenceTables.instanceTypes?.map( it => ({ label: it.name, value: it.id, @@ -317,7 +317,7 @@ class InstanceForm extends React.Component { }), ) : []; - const instanceNoteTypeOptions = referenceTables.instanceNoteTypes ? referenceTables.instanceNoteTypes.map( + const instanceNoteTypeOptions = referenceTables.instanceNoteTypes ? referenceTables.instanceNoteTypes?.map( it => ({ label: it.name, value: it.id, @@ -325,7 +325,7 @@ class InstanceForm extends React.Component { }), ) : []; - const instanceStatusOptions = referenceTables.instanceStatuses ? referenceTables.instanceStatuses.map( + const instanceStatusOptions = referenceTables.instanceStatuses ? referenceTables.instanceStatuses?.map( it => ({ label: `${it.name} (${it.source}: ${it.code})`, value: it.id, @@ -333,7 +333,7 @@ class InstanceForm extends React.Component { }), ) : []; - const modeOfIssuanceOptions = referenceTables.modesOfIssuance ? referenceTables.modesOfIssuance.map( + const modeOfIssuanceOptions = referenceTables.modesOfIssuance ? referenceTables.modesOfIssuance?.map( it => ({ label: it.name, value: it.id, @@ -342,7 +342,7 @@ class InstanceForm extends React.Component { ) : []; const statisticalCodeOptions = referenceTables.statisticalCodes - .map( + ?.map( code => ({ label: refLookup(referenceTables.statisticalCodeTypes, code.statisticalCodeTypeId).name + ': ' + code.code + ' - ' + code.name, value: code.id, @@ -355,7 +355,7 @@ class InstanceForm extends React.Component { // we don't want the type selection box for parent/child to include the preceding-succeeding type const rTypes = referenceTables.instanceRelationshipTypes; const mostParentChildRelationships = filter(rTypes, rt => rt.id !== psTitleRelationshipId(rTypes)); - const relationshipTypes = mostParentChildRelationships.map(it => ({ + const relationshipTypes = mostParentChildRelationships?.map(it => ({ label: it.name, value: it.id, })); From 64620c604ce5f209d1722be426d5ffac08e4c8b3 Mon Sep 17 00:00:00 2001 From: Oleksandr Hladchenko1 Date: Wed, 18 Oct 2023 23:25:51 +0300 Subject: [PATCH 2/3] UIIN-2600: Use ternary --- src/edit/InstanceForm.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/edit/InstanceForm.js b/src/edit/InstanceForm.js index ac1407e15..ab7ae30b2 100644 --- a/src/edit/InstanceForm.js +++ b/src/edit/InstanceForm.js @@ -309,7 +309,7 @@ class InstanceForm extends React.Component { return ref || {}; }; - const instanceTypeOptions = referenceTables.instanceTypes ? referenceTables.instanceTypes?.map( + const instanceTypeOptions = referenceTables.instanceTypes ? referenceTables.instanceTypes.map( it => ({ label: it.name, value: it.id, @@ -317,7 +317,7 @@ class InstanceForm extends React.Component { }), ) : []; - const instanceNoteTypeOptions = referenceTables.instanceNoteTypes ? referenceTables.instanceNoteTypes?.map( + const instanceNoteTypeOptions = referenceTables.instanceNoteTypes ? referenceTables.instanceNoteTypes.map( it => ({ label: it.name, value: it.id, @@ -325,7 +325,7 @@ class InstanceForm extends React.Component { }), ) : []; - const instanceStatusOptions = referenceTables.instanceStatuses ? referenceTables.instanceStatuses?.map( + const instanceStatusOptions = referenceTables.instanceStatuses ? referenceTables.instanceStatuses.map( it => ({ label: `${it.name} (${it.source}: ${it.code})`, value: it.id, @@ -333,7 +333,7 @@ class InstanceForm extends React.Component { }), ) : []; - const modeOfIssuanceOptions = referenceTables.modesOfIssuance ? referenceTables.modesOfIssuance?.map( + const modeOfIssuanceOptions = referenceTables.modesOfIssuance ? referenceTables.modesOfIssuance.map( it => ({ label: it.name, value: it.id, @@ -341,21 +341,21 @@ class InstanceForm extends React.Component { }), ) : []; - const statisticalCodeOptions = referenceTables.statisticalCodes - ?.map( + 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 const rTypes = referenceTables.instanceRelationshipTypes; const mostParentChildRelationships = filter(rTypes, rt => rt.id !== psTitleRelationshipId(rTypes)); - const relationshipTypes = mostParentChildRelationships?.map(it => ({ + const relationshipTypes = mostParentChildRelationships.map(it => ({ label: it.name, value: it.id, })); From c2d38fd4c901f4a111e21baf64ba065f16c03e26 Mon Sep 17 00:00:00 2001 From: Oleksandr Hladchenko <85172747+OleksandrHladchenko1@users.noreply.github.com> Date: Wed, 18 Oct 2023 23:30:15 +0300 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e310cd04..2f63c6c10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change history for ui-inventory + +## [10.1.0] IN PROGRESS + + ## [10.0.1] IN PROGRESS * Instance 3rd pane: Adjust behavior when returning to instance from holdings/item full screen. Refs UIIN-2453.