Stringifying events takes a long time (in actions addon)
See original GitHub issueDescribe the bug Action addon took surprisingly long time to response (freeze the screen >4 sec).
To Reproduce Steps to reproduce the behavior:
- Given any dummy button component.
- Hook onClick action with
action
addon function. - Wait >4 sec to get response, the UI is totally blocked and unresponsive
An example from official-storybook
: http://localhost:9011/?path=/story/basics-link--no-cancel-w-onclick
Expected behavior A instantaneous response <150ms.
Screenshots
A bit profiling here, I’m render my story into standalone iFrame mode. This profiling shows the complicated string operation happened down to the message channel:
Code snippets If applicable, add code samples to help explain your problem.
System:
- OS: MacOS Mojave
- Device: MacBook Air 2013-mid
- Browser: Chrome 72
- Framework: React 16.8.1
- Version: v5.0.0-beta.2
Additional context The component is a pure material-ui button. I thought my custom addons have some role on this but I still have faced this issue even I only have 1 story and no other addon at all…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:19 (13 by maintainers)
Awesome! Thanks for the quick response 👍
This issue is still apparent to us, even after upgrading the storybook to 5.1.9 .
Only adding
depth: 3
fixes the problem, but that’s a workaround, not a solution. As I’ve seen in https://github.com/storybookjs/storybook/issues/2590 , events shouldn’t be serialized at all?That’s how it looks like for us:
Without the
depth: 3
, printing the event takes ~3-7s on my MacBook Air.Probably because
event.view
isWindow
and window has an infinite recursion to itself (window.self === window
).