Skip to content

Commit

Permalink
UIEH-1442: Do not run clearPackageTitles when loading package titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro-Melnyshyn committed Jan 20, 2025
1 parent 2a690fb commit d06d559
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 0 additions & 9 deletions src/routes/package-show-route/package-show-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,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

0 comments on commit d06d559

Please sign in to comment.