Open
Description
Preconditions and environment
- Magento version 2.3.7+
Test from blank theme
Steps to reproduce
1/ Create file requirejs-config.js at root folder theme
example: app/design/frontend/Magento/blank/requirejs-config.js
var config = {
config: {
mixins: {
'mage/loader': {
'js/mage/loader-mixin': true
}
}
}
};
2/ Create file mixin in web/js/mage/loader-mixin.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'mage/template',
'jquery-ui-modules/widget',
'mage/translate'
], function ($, mageTemplate) {
'use strict';
let mixin = {
options: {
icon: '',
texts: {
loaderText: $.mage.__('Please wait...'),
imgAlt: $.mage.__('Loading...'),
mainText: $.mage.__('We are processing your payment'),
placeOrderText: $.mage.__('Payment is currently being processed by the payment partner. This may take up to 60 second. Please wait a moment.')
},
template:
'<div class="c-loader-with-text">' +
'<div class="loading-mask" data-role="loader">' +
'<div class="loader">' +
'<img alt="<%- data.texts.imgAlt %>" src="<%- data.icon %>"/>' +
'<div class="loader-text" style="display: none">' +
'<strong class="main-text"><%- data.texts.mainText %></strong>' +
'<span class="sub-text"><%- data.texts.placeOrderText %></span>' +
'</div>' +
'</div>' +
'</div>' +
'</div>'
},
/**
* Render loader
* @protected
*/
_render: function () {
var html;
console.log(html);
if (!this.spinnerTemplate) {
this.spinnerTemplate = mageTemplate(this.options.template);
html = $(this.spinnerTemplate({
data: this.options
}));
html.prependTo(this.element);
this.spinner = html;
}
},
};
return function (targetWidget) {
$.widget('mage.loader', $.mage.loader, mixin);
return $.mage.loader;
};
});
3/ Re-deploy static content
4/ Trigger loader from frontend
Go to homepage
open devtool example Chrome browser
run code
jQuery('body').trigger('processStart');
Expected result
Only trigger one html
Actual result
mixin js file run/executed correct but it triggered twice
html loader appended show twice in DOM
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmedMay be fixed according to the position in the backlog.Indicates original Magento version for the Issue report.The issue has been reproduced on latest 2.4-develop branchIssue related to Developer Experience and needs help with Triage to Confirm or Reject it