Sometimes the notification messages don't get disappear on page reload or when I navigate to the different page.
Is there some kind of timeout
for the notification message or some session cookies?
I followed this link
Magento 2 : Error/Success message won't remove from page after refresh once display
But where should I put this code so that _deleteMessage
call every time when the page reloads or user navigates to a different page.
This issue is more prominent in iPhone devices safari browser
.
This is my code in messages.js
this.cookieMessages = _.unique($.cookieStorage.get('mage-messages'), 'text')[_.unique($.cookieStorage.get('mage-messages'), 'text').length-1];
this.messages = customerData.get('messages').extend({
disposableCustomerData: 'messages'
});
if (!_.isEmpty(this.messages().messages)) {
customerData.set('messages', {});
}
customerData.set('messages', {messages: ""});
$.cookieStorage.set('mage-messages', '');
On further debugging, My code randomly breaks anywhere due to WebAPI socket
error on console js debugging.
So this WebAPI socket
error doesn't let this cookie
clear.
This issue is intermittent.
Thanks in advance