Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Converting circular structure to JSON with StorybookJS on React Native

This happens whenever I navigate to a new Story within the Storybook Navigator. Thanks!

ExceptionsManager.js:126 Unhandled JS Exception: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'HooksContext'
    |     property 'currentContext' -> object with constructor 'Object'
    --- property 'hooks' closes the circle

I'm using React Native 0.61.5 and @storybook/react-native 5.3.9

enter image description here

like image 529
Brandon J Brotsky Avatar asked Sep 15 '25 02:09

Brandon J Brotsky


1 Answers

I'm dealing with the same issue and unfortunately don't have enough experience with Storybook or React Native to diagnose.

However, I was able to patch the module as described in https://github.com/storybookjs/storybook/issues/9294, i.e. "hooks.currentContext = Object.assign({}, context, { hooks: null });"

To reiterate, this is not a perfect solution, as the original bug comes from the nested, circular relationship between currentContext and hooks. This simply sets hooks to null to terminate the circular structure.

like image 119
Bobby Moogs Avatar answered Sep 16 '25 16:09

Bobby Moogs