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

Reset compare products counter after faceted search updates page content #1571

Merged
merged 1 commit into from
Sep 6, 2019
Merged

Reset compare products counter after faceted search updates page content #1571

merged 1 commit into from
Sep 6, 2019

Conversation

jbruni
Copy link
Contributor

@jbruni jbruni commented Sep 4, 2019

What?

This pull request implements a bug fix.

It requires "Product Filtering" to be turned on for the store.

When we select a faceted search filter, Cornerstone updates the page without reloading. It does an AJAX request and updates the URL using the History API. Some sections of contents are updated, with the HTML contents returned in the AJAX call response.

The problem is when we do this faceted search filter selection when we already have a few products selected for comparison, and the "Compare" link at the top header is appearing and active, with the number of selected products.

After the faceted search dynamic update described above is performed, the "Compare" link becomes out of sync with the updated contents. The "Compare" link keeps showing the same product count, and has the same URL. But... the updated contents contain no product selected for comparison, at all.

At this point, if we select another product for comparison (even the SAME previously selected product), the counter will be increased - although we are selecting the first product for comparison, among the filtered results.

This bug is very easy to reproduce, in unchanged Cornerstone theme, as long as we have Product Filtering turned on and some facets and products to play with.

This pull request simply resets the "compare products" counter / array, immediately after the page contents are updated with the faceted search results.

Tickets / Documentation

N/A

Screenshots (if appropriate)

N/A

@bigbot
Copy link

bigbot commented Sep 4, 2019

Autotagging @bigcommerce/storefront-team @davidchin

junedkazi
junedkazi previously approved these changes Sep 6, 2019
Copy link
Contributor

@junedkazi junedkazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbruni can you please add a changelog entry.

@jbruni
Copy link
Contributor Author

jbruni commented Sep 6, 2019

@junedkazi - I have amended the commit, including the changelog entry in it.

@junedkazi junedkazi merged commit 36818d2 into bigcommerce:master Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants