3

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

  • I had this issue once. disabling the Customer Notification cache solved my issue – Philipp Sander Mar 11 at 14:41
  • @PhilippSander How to disable the Customer Notification cache – summu Mar 11 at 14:45
  • @PhilippSander got it from admin panel – summu Mar 11 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.