Skip to content

Commit d37d0fd

Browse files
author
Olexii Korshenko
committed
MAGETWO-39758: Add Loader for Mini Shopping Cart
1 parent 689e99e commit d37d0fd

File tree

1 file changed

+4
-1
lines changed
  • app/code/Magento/Checkout/view/frontend/web/js/view

1 file changed

+4
-1
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ define([
1212
'use strict';
1313

1414
var sidebarInitialized = false;
15+
var addToCartCalls = 0;
1516
url.setBaseUrl(window.checkout.baseUrl);
1617

1718
function initSidebar() {
@@ -61,10 +62,12 @@ define([
6162
this._super();
6263
this.cart = customerData.get('cart');
6364
this.cart.subscribe(function () {
64-
this.isLoading(false);
65+
addToCartCalls--;
66+
this.isLoading(addToCartCalls > 0);
6567
sidebarInitialized = false;
6668
}, this);
6769
$('[data-block="minicart"]').on('contentLoading', function(event) {
70+
addToCartCalls++;
6871
self.isLoading(true);
6972
});
7073
},

0 commit comments

Comments
 (0)