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

Component with prop of type object or function leads to "Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Window'" #250

Closed
6 tasks done
antony-k1208 opened this issue Aug 17, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@antony-k1208
Copy link

Describe the bug

Define a component with a prop of type function or with a prop of type object.
When using the object type, one property of that object should be a function.
That same component should have an onclick listener, which either calls the function prop or the function property of the object prop.

Inside a story use that same component and define a ref and a function in the script tag.
The function should change the ref's content.

Pass that same function as prop to the earlier defined component, again either for the function prop or the object prop.

Click the component, so the event listener gets triggered, which should call your defined function and change the ref's contents.

The function seems to be executed but you will immediately see an error pop up in your console:

Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Window': function updateState() {
state.value = true
} could not be cloned.

When you do not touch any state inside the function no error occurs. So for example if you only log something to the console or trigger an alert.

Is this related to not using an iframe for the story rendering, which is mentioned here: https://histoire.dev/examples/vue3/single-stories.html#integrated ?

Reproduction

https://stackblitz.com/edit/histoire-vue3-starter-4nrxsf?file=src%2FBaseButton.vue,src%2FBaseButton.story.vue

System Info

System:
    OS: macOS 12.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 4.25 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.volta/tools/image/node/16.15.0/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 8.5.5 - ~/.volta/tools/image/node/16.15.0/bin/npm
  Browsers:
    Brave Browser: 104.1.42.88
    Firefox: 96.0.1
    Safari: 15.6

Used Package Manager

npm

Validations

@antony-k1208 antony-k1208 added the to triage This issue needs to be triaged label Aug 17, 2022
@Akryum Akryum self-assigned this Aug 17, 2022
@Akryum Akryum added bug Something isn't working and removed to triage This issue needs to be triaged labels Aug 17, 2022
@Akryum Akryum closed this as completed in 0f5b400 Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants