diff --git a/CHANGELOG.md b/CHANGELOG.md index 582458708..61d25184c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Instance. Series heading has vanished in detailed view. Fixes UIIN-2601. * Add immediate warning message when a local instance is shared. Refs UIIN-2617. * Optimistic locking message not working for instances in non-consortial tenant. Fixes UIIN-2628. +* User receives an error when searching for an item in the Inventory app. Fixes UIIN-2634. ## [10.0.1](https://github.com/folio-org/ui-inventory/tree/v10.0.1) (2023-11-03) [Full Changelog](https://github.com/folio-org/ui-inventory/compare/v10.0.0...v10.0.1) diff --git a/src/ViewHoldingsRecord.js b/src/ViewHoldingsRecord.js index cfa48ddc8..81d06a913 100644 --- a/src/ViewHoldingsRecord.js +++ b/src/ViewHoldingsRecord.js @@ -501,9 +501,10 @@ class ViewHoldingsRecord extends React.Component { referenceTables, goTo, stripes, - location: { state: { tenantFrom } }, + location, } = this.props; const { instance } = this.state; + const tenantFrom = location?.state?.tenantFrom || stripes.okapi.tenant; if (this.isAwaitingResource()) return ; diff --git a/src/components/InstancesList/InstancesList.js b/src/components/InstancesList/InstancesList.js index afe57ce1e..49a468b63 100644 --- a/src/components/InstancesList/InstancesList.js +++ b/src/components/InstancesList/InstancesList.js @@ -16,6 +16,7 @@ import { import saveAs from 'file-saver'; import moment from 'moment'; import classnames from 'classnames'; +import { stringify } from 'query-string'; import { Pluggable, @@ -134,6 +135,7 @@ class InstancesList extends React.Component { }), stripes: PropTypes.object.isRequired, history: PropTypes.shape({ + push: PropTypes.func, listen: PropTypes.func, replace: PropTypes.func, }), @@ -956,8 +958,9 @@ class InstancesList extends React.Component { const { parentResources, parentMutator: { itemsByQuery }, - goTo, getParams, + stripes, + history, } = this.props; const { query, qindex } = parentResources?.query ?? {}; const { searchInProgress } = this.state; @@ -973,7 +976,10 @@ class InstancesList extends React.Component { } itemsByQuery.reset(); - const items = await itemsByQuery.GET({ params: { query: itemQuery } }); + const items = await itemsByQuery.GET({ + params: { query: itemQuery }, + tenant: stripes.okapi.tenant, + }); this.setState({ searchInProgress: false }); @@ -984,7 +990,13 @@ class InstancesList extends React.Component { } const { id, holdingsRecordId } = items[0]; - goTo(`/inventory/view/${instance.id}/${holdingsRecordId}/${id}`, getParams()); + const search = stringify(getParams()); + + history.push({ + pathname: `/inventory/view/${instance.id}/${holdingsRecordId}/${id}`, + search, + state: { tenantTo: stripes.okapi.tenant }, + }); return null; } diff --git a/src/components/InstancesList/InstancesList.test.js b/src/components/InstancesList/InstancesList.test.js index ea5f0f3d3..2c88470d9 100644 --- a/src/components/InstancesList/InstancesList.test.js +++ b/src/components/InstancesList/InstancesList.test.js @@ -559,6 +559,7 @@ describe('InstancesList', () => { params: { query: `${option}=="${_query}"`, }, + tenant: 'diku', }); }); });