diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa457266e..f009b54741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/assets/js/theme/common/faceted-search.js b/assets/js/theme/common/faceted-search.js index a94adda37f..f2afa96fc5 100644 --- a/assets/js/theme/common/faceted-search.js +++ b/assets/js/theme/common/faceted-search.js @@ -431,15 +431,8 @@ class FacetedSearch { } onPopState() { - 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'); } }