Skip to content

Commit

Permalink
(#3289) This PR adds a product wrapper class by repurposing the exist…
Browse files Browse the repository at this point in the history
…ing product-info class and migrating product-update specific logic out of the VariantSelects class. A product wrapper enables children to more trivially perform global updates by providing a heirarchical "namespace"--i.e. child publishes event, parent captures and declaratively updates other children VS child updates siblings. By extracting the VariantSelects onChange logic to use this pattern, VariantSelects is able to be a single-purpose class, it is easier to understand why siblings are updated, and we were able to eliminate some really gross logic that handled variant change updates differently depending on the wrapping context.
  • Loading branch information
lhoffbeck committed May 23, 2024
1 parent 89472ef commit 45f65d3
Show file tree
Hide file tree
Showing 11 changed files with 396 additions and 414 deletions.
2 changes: 1 addition & 1 deletion assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ input[type='checkbox'] {
position: relative;
}

product-info .loading__spinner:not(.hidden) ~ *,
.product__info-container .loading__spinner:not(.hidden) ~ *,
.quantity__rules-cart .loading__spinner:not(.hidden) ~ * {
visibility: hidden;
}
Expand Down
1 change: 1 addition & 0 deletions assets/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ON_CHANGE_DEBOUNCE_TIMER = 300;
const PUB_SUB_EVENTS = {
cartUpdate: 'cart-update',
quantityUpdate: 'quantity-update',
variantChangeStart: 'variant-change-start',
variantChange: 'variant-change',
cartError: 'cart-error',
sectionRefreshed: 'section-refreshed',
Expand Down
Loading

0 comments on commit 45f65d3

Please sign in to comment.