Skip to content

Commit

Permalink
fix: don't render delivery options when already visible (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Ernst authored and EdieLemoine committed Jun 14, 2022
1 parent 5f5437b commit d5c084a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion view/frontend/web/js/view/delivery-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ define(
disablePickup: 'myparcel-delivery-options__delivery--pickup',

isUsingMyParcelMethod: true,
deliveryOptionsAreVisible: false,

/**
* The selector of the field we use to get the delivery options data into the order.
Expand Down Expand Up @@ -134,10 +135,11 @@ define(

const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.intersectionRatio === 0 || deliveryOptions.deliveryOptions) {
if (entry.intersectionRatio === 0 || deliveryOptions.deliveryOptions || this.deliveryOptionsAreVisible) {
return;
}
deliveryOptions.render();
this.deliveryOptionsAreVisible = true;
}, {
root: null,
rootMargin: '0px',
Expand Down

0 comments on commit d5c084a

Please sign in to comment.