Bizarre behavior with flash message

I got this ‘add to watchlist’ link on my product page, and when you click on the button it flashes up a message ok. But, when I visit my watch list page, I am getting the same message. (basically watch list item was successfully created).

Not sure exactly why that’s happening. :frowning:

Thanks, Joe

Try setting your flash message using flash.now.

Flash messages are persisted for one additional controller action after the one it’s set on. If you haven’t done a full page-change via a controller action, it’ll stick around longer than you intend.

When you set the flash message using flash.now, the flash message will only persist for your current action, and you shouldn’t get that double flash problem you’re experiencing right now.

You can find more info in the flash section of the API docs (sorry the API site won’t let me link a specific section).

Thanks, I’ll try that out.

yes, that worked! Thanks for pointing that out.