Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ define([
}).always(function () {
// Stop loader for totals block
totalsService.isLoading(false);
// Check for new session messages
customerData.reload('messages');
Copy link
Contributor

Choose a reason for hiding this comment

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

Such changes will add one more request to the server on every totals calculation request. I think it's not optimal way for define extension points. Messages should be reloaded only in cases when needed (by additinal handlers in 3d party extensions).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. #17127 takes care of that.

Only concern at this point is that there's no way for one module to know if another has decided to do that, but I think it'll be fine. I'll retract this PR then

});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ define([
'Magento_Customer/js/customer-data': {
get: function () {
},
reload: jasmine.createSpy(),
set: jasmine.createSpy()
}
},
Expand Down Expand Up @@ -124,6 +125,7 @@ define([
expect(mocks['Magento_Checkout/js/model/totals'].isLoading.calls.argsFor(0)[0]).toBe(true);
expect(mocks['Magento_Checkout/js/model/totals'].isLoading.calls.argsFor(1)[0]).toBe(false);
expect(mocks['mage/storage'].post).toHaveBeenCalled();
expect(mocks['Magento_Customer/js/customer-data'].reload).toHaveBeenCalledWith('messages');
expect(mocks['Magento_Checkout/js/model/cart/cache'].get).not.toHaveBeenCalled();
expect(mocks['Magento_Checkout/js/model/cart/cache'].set).toHaveBeenCalledWith('cart-data', data);
});
Expand All @@ -143,6 +145,7 @@ define([
expect(mocks['Magento_Checkout/js/model/totals'].isLoading.calls.argsFor(0)[0]).toBe(true);
expect(mocks['Magento_Checkout/js/model/totals'].isLoading.calls.argsFor(1)[0]).toBe(false);
expect(mocks['mage/storage'].post).toHaveBeenCalled();
expect(mocks['Magento_Customer/js/customer-data'].reload).toHaveBeenCalledWith('messages');
expect(mocks['Magento_Checkout/js/model/cart/cache'].get).not.toHaveBeenCalled();
expect(mocks['Magento_Checkout/js/model/error-processor'].process).toHaveBeenCalledWith('Error Message');
});
Expand Down