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

UIEH-1442: Do not run clearPackageTitles when loading package titles (follow-up PR). #1761

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

.titlesListContainer {
max-width: calc(var(--container-max-width) - 2rem);
height: 560px;
margin: 0 auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import InternalLink from '../../../../internal-link';
import CoverageDateList from '../../../../coverage-date-list';
import { isBookPublicationType } from '../../../../utilities';

import styles from '../../package-show.css';
import styles from './PackageTitleList.css';

const COLUMNS = {
STATUS: 'status',
Expand All @@ -22,7 +22,7 @@ const COLUMNS = {
MANAGED_EMBARGO: 'managedEmbargo',
};

const MAX_HEIGHT = 526;
const MAX_HEIGHT = 520;

const propTypes = {
count: PropTypes.number.isRequired,
Expand Down
11 changes: 0 additions & 11 deletions src/routes/package-show-route/package-show-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import ReactRouterPropTypes from 'react-router-prop-types';
import queryString from 'qs';
import isEqual from 'lodash/isEqual';
import reduce from 'lodash/reduce';

import { TitleManager } from '@folio/stripes/core';

Expand All @@ -25,7 +24,6 @@ class PackageShowRoute extends Component {
static propTypes = {
accessStatusTypes: accessTypesReduxStateShape.isRequired,
clearCostPerUseData: PropTypes.func.isRequired,
clearPackageTitles: PropTypes.func.isRequired,
costPerUse: costPerUseShape.CostPerUseReduxStateShape.isRequired,
destroyPackage: PropTypes.func.isRequired,
getAccessTypes: PropTypes.func.isRequired,
Expand Down Expand Up @@ -282,17 +280,8 @@ class PackageShowRoute extends Component {
const {
location,
history,
clearPackageTitles,
} = this.props;

const paramDifference = reduce(pkgSearchParams, (result, item, key) => {
return isEqual(item, this.state.pkgSearchParams[key]) ? result : result.concat(key);
}, []);

if (!(paramDifference.length === 1 && paramDifference[0] === 'page')) {
clearPackageTitles();
}

const qs = queryString.parse(location.search, { ignoreQueryPrefix: true });
const search = queryString.stringify({
...qs,
Expand Down
6 changes: 3 additions & 3 deletions src/routes/package-show-route/package-show-route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ describe('Given PackageShowRoute', () => {
});
});

describe('when changed param is not single and it is not "page"', () => {
it('should handle clearPackageTitles', async () => {
describe('when packages are being fetched', () => {
it('should not clear old ones', async () => {
const {
getByRole,
} = renderPackageShowRoute({
Expand All @@ -586,7 +586,7 @@ describe('Given PackageShowRoute', () => {

await userEvent.type(searchBox, 'Title name{enter}');

expect(mockClearPackageTitles).toHaveBeenCalled();
expect(mockClearPackageTitles).not.toHaveBeenCalled();
});
});
});
Expand Down
Loading