diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ffd31663..55b4dd861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change history for ui-inventory +## [12.0.5](https://github.com/folio-org/ui-inventory/tree/v12.0.5) (2024-12-04) +[Full Changelog](https://github.com/folio-org/ui-inventory/compare/v12.0.4...v12.0.5) + +* Display informative error message when editing same instance, holdings, item in two tabs. Fixes UIIN-3127. +* User can edit Source consortium "Holdings sources" in member tenant but not in Consortia manager. Refs UIIN-3147. +* Set the previously used offset by executing `resultOffset.replace` when changing the segment. Fixes UIIN-3143. + ## [12.0.4](https://github.com/folio-org/ui-inventory/tree/v12.0.4) (2024-12-03) [Full Changelog](https://github.com/folio-org/ui-inventory/compare/v12.0.3...v12.0.4) diff --git a/package.json b/package.json index 8b4933afb..2e5238517 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/inventory", - "version": "12.0.4", + "version": "12.0.5", "description": "Inventory manager", "repository": "folio-org/ui-inventory", "publishConfig": { diff --git a/src/components/InstancesList/InstancesList.js b/src/components/InstancesList/InstancesList.js index f8ec0537b..91c606f30 100644 --- a/src/components/InstancesList/InstancesList.js +++ b/src/components/InstancesList/InstancesList.js @@ -265,6 +265,8 @@ class InstancesList extends React.Component { data, location, segment, + parentMutator, + getLastSearchOffset, } = this.props; const sortBy = this.getSortFromParams(); @@ -297,6 +299,12 @@ class InstancesList extends React.Component { searchParams.set('sort', data.displaySettings.defaultSort); this.redirectToSearchParams(searchParams); } + + if (prevProps.segment !== segment) { + const lastSearchOffset = getLastSearchOffset(segment); + + parentMutator.resultOffset.replace(lastSearchOffset); + } } componentWillUnmount() { diff --git a/src/components/InstancesList/InstancesList.test.js b/src/components/InstancesList/InstancesList.test.js index 70bb386c4..26eea8776 100644 --- a/src/components/InstancesList/InstancesList.test.js +++ b/src/components/InstancesList/InstancesList.test.js @@ -448,6 +448,27 @@ describe('InstancesList', () => { expect(mockStoreLastSearchOffset).toHaveBeenCalledWith(offset, 'instances'); }); }); + + describe('and segment has been changed', () => { + it('should apply offset from storage', () => { + const lastSearchOffset = 200; + + const { rerender } = renderInstancesList({ + segment: segments.instances, + }); + + mockStoreLastSearchOffset.mockClear(); + mockResultOffsetReplace.mockClear(); + mockGetLastSearchOffset.mockReturnValueOnce(lastSearchOffset); + + rerender(getInstancesListTree({ + segment: segments.holdings, + })); + + expect(mockGetLastSearchOffset).toHaveBeenCalledWith(segments.holdings); + expect(mockResultOffsetReplace).toHaveBeenCalledWith(lastSearchOffset); + }); + }); }); describe('when user clicks Reset all', () => { diff --git a/src/settings/HoldingsSourcesSettings.js b/src/settings/HoldingsSourcesSettings.js index f8b957aed..0af79eeb2 100644 --- a/src/settings/HoldingsSourcesSettings.js +++ b/src/settings/HoldingsSourcesSettings.js @@ -27,7 +27,7 @@ class HoldingsSourcesSettings extends React.Component { render() { const hasPerm = this.props.stripes.hasPerm('ui-inventory.settings.holdings-sources'); - const suppress = getSourceSuppressor(RECORD_SOURCE.FOLIO); + const suppress = getSourceSuppressor([RECORD_SOURCE.FOLIO, RECORD_SOURCE.CONSORTIUM]); return ( diff --git a/src/utils.js b/src/utils.js index 11a9127fb..70697919b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -702,7 +702,7 @@ export const parseHttpError = async httpError => { let jsonError = {}; try { - if (contentType === 'text/plain') { + if (contentType.includes('text/plain')) { jsonError.message = await httpError.text(); } else { jsonError = await httpError.json();