magento2: Mixin js not loading when Switch Tab while loading site

Preconditions

  1. Magento 2.2.*
  2. Open Multiple Tabs in browser
  3. Create one mixins file

Steps to reproduce

  1. open your site (open your developer console)
  2. switch to another tab
  3. after finish load step 1 site go to there
  4. In console you can check no mixins js load

Expected result It should be load all mixins js file.

Actual result It is not loading mixins js

For example we are creating mixins for

var config = {   
	config: {
		mixins: {
			'Magento_Catalog/js/catalog-add-to-cart': {
				'NameSpace_ModuleNaame/js/catalog/catalog-add-to-cart-mixins': true
			}
		}
	}
};

catalog-add-to-cart-mixins.js code

define([
	'jquery'
], function($) {
	'use strict';

	return function (widget) {
		$.widget('mage.catalogAddToCart', $.mage.catalogAddToCart, {
			enableAddToCartButton: function (formElement) {
				this._super(formElement);
				if(formElement.attr('id') == 'product_addtocart_form') {
					$("html, body").animate({ scrollTop: 0 }, "slow");
				}
			}
		});
		return $.mage.catalogAddToCart;
	}
});

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 24 (8 by maintainers)

Most upvoted comments

@sunilit42 , thank you for your report. We were not able to reproduce this issue by following the steps you provided. Please provide more detailed steps to reproduce or try to reproduce this issue on a clean installation.