Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom actions don't seem to be working. #671

Open
HenryMBaldwin opened this issue Jan 2, 2025 · 1 comment
Open

Custom actions don't seem to be working. #671

HenryMBaldwin opened this issue Jan 2, 2025 · 1 comment

Comments

@HenryMBaldwin
Copy link

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.

@addisonschultz
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants