Custom actions don't seem to be working.
I've followed the documentation as best I can, and have confirmed using a listener in a console that my embed in a webframe component is sending custom action messages via
window.parent.postMessage({
action: {
type: 'resize',
}
}, '*');
No matter what I do though, I cannot get the action callback on the component to run
action: async (previous, action) => {
console.log("action");
switch (action.action) {
case 'resize':
console.log("resize");
break;
}
return {}
},
These snippets in my code are essentially exactly the same as the documentation. Are there any known bugs around this or have I misunderstood custom actions?
And yes, I'm and checking for "console.log()" messages in my terminal that is running the integration locally, not the browser console.
Hi @HenryMBaldwin - I think this example in the documentation isn’t passing in the action as needed unfortunately, apologies on that.
We use this format in the Mermaid integration, you can see it here:
function sendAction(action) {
window.top.postMessage(
{
action,
},
'*'
);
}
You should rename type: ‘resize’ in the example you’ve used to action: ‘resize’ - can you let me know if that works?