-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Circular json can possibly hang #1881
Conversation
Codecov Report
@@ Coverage Diff @@
## release/3.3 #1881 +/- ##
===============================================
- Coverage 22.25% 22.18% -0.08%
===============================================
Files 324 326 +2
Lines 6339 6465 +126
Branches 797 812 +15
===============================================
+ Hits 1411 1434 +23
- Misses 4333 4448 +115
+ Partials 595 583 -12
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
addons/actions/src/preview.test.js
Outdated
@@ -23,5 +23,8 @@ describe('preview', () => { | |||
expect(channel.emit.mock.calls[0][1].id).toBe('42'); | |||
expect(channel.emit.mock.calls[1][1].id).toBe('24'); | |||
}); | |||
it('should be able to handle cyclic object without hanging', () => { | |||
action('foo')(process); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, that's kind of funny actually!
@@ -0,0 +1,117 @@ | |||
export const CLASS_NAME_KEY = '$___storybook.className'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might this be it's own npm module maybe?
Thank you for this PR @rhalff ! 🙇 I have a question about if we could extract the util you added into a separate npm module, maybe now, or later. But I won't block merging for that. |
Waiting for a second review |
this might fix - #1839 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1
this feels like a patch version to me. thoughts @ndelangen @shilman?
json-stringify-safe
with a custom version of JSON-js's decycle and retrocycle.It makes no sense to render these while the logged objects come directly from JSON.parse.
The non-enumerability is used to set some properties to restore the original constructor names.
react-inspector
will then use these to render the correct labels.[<name>...]
Perhaps the documentation should make clear that whatever is logged is not the original object.
This is due to the objects being stringified first and then restored again.
fixes #778