Skip to content

Commit aca3ba4

Browse files
committed
Merge remote-tracking branch 'l3/ACP2E-2267' into Tier4-PR-Delivery-11-18-23
2 parents 298cbd4 + 064c834 commit aca3ba4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

app/code/Magento/Theme/view/frontend/templates/messages.phtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@
1818
</div>
1919
<!-- /ko -->
2020

21-
<!-- ko if: messages().messages && messages().messages.length > 0 -->
2221
<div aria-atomic="true" role="alert" class="messages" data-bind="foreach: {
2322
data: messages().messages, as: 'message'
24-
}">
23+
}, afterRender: purgeMessages">
2524
<div data-bind="attr: {
2625
class: 'message-' + message.type + ' ' + message.type + ' message',
2726
'data-ui-id': 'message-' + message.type
2827
}">
2928
<div data-bind="html: $parent.prepareMessageForHtml(message.text)"></div>
3029
</div>
3130
</div>
32-
<!-- /ko -->
3331
</div>
32+
3433
<script type="text/x-magento-init">
3534
{
3635
"*": {

app/code/Magento/Theme/view/frontend/web/js/view/messages.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ define([
4444
disposableCustomerData: 'messages'
4545
});
4646

47-
// Force to clean obsolete messages
48-
if (!_.isEmpty(this.messages().messages)) {
49-
customerData.set('messages', {});
50-
}
51-
5247
$.mage.cookies.set('mage-messages', '', {
5348
samesite: 'strict',
5449
domain: ''
@@ -63,6 +58,11 @@ define([
6358
*/
6459
prepareMessageForHtml: function (message) {
6560
return escaper.escapeHtml(message, this.allowedTags);
61+
},
62+
purgeMessages: function () {
63+
if (!_.isEmpty(this.messages().messages)) {
64+
customerData.set('messages', {});
65+
}
6666
}
6767
});
6868
});

0 commit comments

Comments
 (0)