Skip to content

Commit

Permalink
UIIN-2634: Remove error when search for an item (#2318)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4054062)
  • Loading branch information
OleksandrHladchenko1 authored and mariia-aloshyna committed Nov 7, 2023
1 parent c52c31d commit 104702b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/ViewHoldingsRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <LoadingView />;

Expand Down
18 changes: 15 additions & 3 deletions src/components/InstancesList/InstancesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}),
Expand Down Expand Up @@ -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;
Expand All @@ -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 });

Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/components/InstancesList/InstancesList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ describe('InstancesList', () => {
params: {
query: `${option}=="${_query}"`,
},
tenant: 'diku',
});
});
});
Expand Down

0 comments on commit 104702b

Please sign in to comment.