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

fix(storefront): BCTHEME-1757 Anchor links on category pages are not working when product filtering is enabled #2415

Merged
merged 1 commit into from
Feb 1, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Draft
- Anchor links on category pages are not working when product filtering is enabled [#2415](https://github.com/bigcommerce/cornerstone/pull/2415)
- Dispatch an event on productOptionsChanged [#2400](https://github.com/bigcommerce/cornerstone/pull/2400)
- Check lang helpers usage and existence of key in translation file [#2403](https://github.com/bigcommerce/cornerstone/pull/2403)
- Display fees on cart page [#2376](https://github.com/bigcommerce/cornerstone/pull/2376)
Expand Down
11 changes: 2 additions & 9 deletions assets/js/theme/common/faceted-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,8 @@ class FacetedSearch {
}

onPopState() {
bc-vlad-dlogush marked this conversation as resolved.
Show resolved Hide resolved
const currentUrl = window.location.href;
const searchParams = new URLSearchParams(currentUrl);
// If searchParams does not contain a page value then modify url query string to have page=1
if (!searchParams.has('page')) {
const linkUrl = $('.pagination-link').attr('href');
const re = /page=[0-9]+/i;
const updatedLinkUrl = linkUrl.replace(re, 'page=1');
window.history.replaceState({}, document.title, updatedLinkUrl);
}
if (document.location.hash !== '') return;

$(window).trigger('statechange');
}
}
Expand Down
Loading