GitbookIO / GitbookIO/integrations

Custom actions don't seem to be working.

Open
#671 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
131
Forks
96
Avg merge
7h 8m
Merged PRs (30d)
31

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the custom-actions documentation and reproduce the reported flow from the webframe component, using the supplied window.parent.postMessage call and action callback as entry points. Trace why the resize message does not reach the callback; done means the documented custom action works or the confirmed limitation and required behavior are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.