Skip to content

Commit

Permalink
Fix 'Cannot read properties of null' error in SliderComponent (#2053)
Browse files Browse the repository at this point in the history
  • Loading branch information
metamoni authored Oct 21, 2022
1 parent 3f89aa5 commit 67fbde2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ class SliderComponent extends HTMLElement {
}

update() {
// Temporarily prevents unneeded updates resulting from variant changes
// This should be refactored as part of https://github.com/Shopify/dawn/issues/2057
if (!this.slider || !this.nextButton) return;

const previousPage = this.currentPage;
this.currentPage = Math.round(this.slider.scrollLeft / this.sliderItemOffset) + 1;

Expand Down

0 comments on commit 67fbde2

Please sign in to comment.