How to preserve the screen messages after reloading the page (for debug)?

Locate the following line in the Magento\Framework\Message\Manager::getMessages() method:

Replace it with the following one:

if (false && $clear) {

See also: