Error: [Platform] rejected handling messages from stale contexts

Hello,

I have a dynamic page with an HTML widget, whose part of the code gets updated by a postMessage() approach when the dynamic dataset is ready. It works as expected, but everytime I move on to the next/previous dynamic item, I get the error:

“Error: [Platform] rejected handling messages from stale contexts”.

This error appears around 40 times everytime I change the dynamic item, and then the page finally updates the HTML widget.

Any help is greatly appreciated.

Page’s code:
$w.onReady( function () {
$w(‘#dynamicDataset’).onReady( function () {
let currItem = $w(‘#dynamicDataset’).getCurrentItem();
$w(‘#html1’).postMessage(currItem.subtitle)
});
});

HTML widget’s code:

I’ve tried waiting for the HTML to send a message to the page once it’s loaded, and only then send the HTML widget back a message to update its content, but I still get the same error.

Thanks.

Hello ! I have plenty messages of this error type on few pages. Did you find a solution ? Thanks !

Tried to put async await?

$w.onReady( function () {

$w('#dynamicDataset').onReady(async function () {
         let currItem = await $w('#dynamicDataset').getCurrentItem();

$w('#html1').postMessage (currItem.legenda) });

});

Which browser are you running? Opera?

I didn’t change my code but the error suddenly stopped happening. I didn’t use async/await (thanks for the suggestion though), and I finally didn’t use either the approach of waiting for the HTML widget to send a message to the main page when it’s fully loaded before I broadcast the message to the HTML widget. It’s been working without any issues so far. I have only tested it on MS Edge.

Thanks a lot.
I’ve only tested on chrome. Will test on others.
Will try also to put away async.