-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
React native fails with JSON.serialization issue #13
Comments
I just ran into this issue as well. The error comes from the use of json-fn, which does not guard against circular references in JSON objects. There is a circular reference in I'm using the following patch to workaround the issue: diff --git a/node_modules/@storybook/addons/dist/hooks.js b/node_modules/@storybook/addons/dist/hooks.js
index 6c88e84..8ad6678 100644
--- a/node_modules/@storybook/addons/dist/hooks.js
+++ b/node_modules/@storybook/addons/dist/hooks.js
@@ -264,7 +264,7 @@ var applyHooks = function applyHooks(applyDecorators) {
var hooks = context.hooks;
hooks.prevMountedDecorators = hooks.mountedDecorators;
hooks.mountedDecorators = new Set([getStory].concat(_toConsumableArray(decorators)));
- hooks.currentContext = context;
+ hooks.currentContext = Object.assign({}, context, { hooks: null });
hooks.hasUpdates = false;
var result = decorated(context);
numberOfRenders = 1; |
cc @Hypnosphi can we patch this if it makes sense? |
Unfortunately, the proposed change doesn't support mutation of context obtained from
As an alternative, we can use |
I will of course defer to you, but I would suggest exposing a setter API as opposed to encouraging a direct mutation: const [context, setContext] = useContext()
...
setContext({ foo: ‘bar’ }) This would support my workaround. But again, I will defer to your judgement. |
+1 |
If I am not mistaken, current version of Storybook is unusable until this is solved right? Is there some older version of Storybook that doesnt have this bug? |
|
Dealing with this issue as well. Any traction on this? |
+1 Same issue, real shame as this tool looks great. Guess while it's unfixed i'll either have to revert or continue without storybook for a bit |
I can confirm that this fix 'works' but can be subtly buggy. For my purposes it is "good enough" to tide me over. |
@arlyon Thanks for posting that diff! It worked for me! Hopefully, the next version fixes this issue. This has been a huge headache for me! |
Patch was suggested here: https://github.com/storybookjs/storybook/issues/9294#issuecomment-580582681 Credit: @arlyon
Thx @doctyper - it works for me too! My 5 cents to folks who are not familiar with patches. To apply the suggested patch (with
|
@jenskuhrjorgensen you still need to install |
@simonepizzamiglio you should add it as a dependency and then, in your package.json scripts phase add the following: |
You are absolutely right, @simonepizzamiglio and @davidnuvolar. I've updated my previous comment - thanks! |
Thanks @jenskuhrjorgensen for the explanation of how to create patches! That worked perfectly for me! |
Any update on this issue ? |
Hey, sadly not yet. But this is on my todo list for this week. |
This also happened to me with |
Hey, I've created a PR to fix it in the main storybook repo. We still are in the middle of migrating out React Native from Storybook monorepo, so I can't promise when exactly the fix will be available, but I will try to get it out as soon as I can. I am sorry that RN Storybook was abandoned for a while. Soon RN Storybook is going to be stable (that is why we are moving it out of main monorepo) and issues like these should stop popping up. |
Sorry I need this fix please. Thanks |
@Gongreg please you can check this thanks |
Hi @jonathanmachado , |
Thanks @davidnuvolar it's working with this fix, only one question this fix remove actions logger? because in my stories I don't see actions event loggs, Thanks again |
Storybook 5.3.14 fixed the issue for me. |
I confirm the fix is working in 5.3.14. Thank you @Gongreg ! |
Great! :) |
Describe the bug
Default configuration with sb stopped working after
beta.25
To Reproduce
Steps to reproduce the behavior:
npx react-native init testSB --template react-native-template-typescript
npx -p @storybook/cli sb init --type react_native
Expected behavior
Should not throw error
Screenshots
System:
Additional context
It still works after downgrade to
beta.25
and it stops working afterbeta.26
and up.The text was updated successfully, but these errors were encountered: