storybook
storybook copied to clipboard
[@storybook/addon-storyshots] Please upgrade the `react-test-renderer` version to v18.1.0 in`addon-storyshots`
Describe the bug
TypeError: Cannot read properties of undefined (reading 'current')
at warnIfNotScopedWithMatchingAct (node_modules/@storybook/addon-storyshots/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14999:31)
at updateContainer (node_modules/@storybook/addon-storyshots/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:16413:7)
at create (node_modules/@storybook/addon-storyshots/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:17149:3)
at getRenderedTree (node_modules/@storybook/addon-storyshots/dist/ts3.9/frameworks/react/renderTree.js:24:18)
at node_modules/@storybook/addon-storyshots/dist/ts3.9/test-bodies.js:9:24
at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/ts3.9/api/snapshotsTestsTemplate.js:29:24)
To Reproduce
- Using react-v18 and following instructions of the document on @storybook/addon-storyshots.
- run
npm test
.
System System: OS: macOS 12.4 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Binaries: Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node Yarn: 1.22.18 - ~/.nvm/versions/node/v16.13.2/bin/yarn npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm Browsers: Chrome: 102.0.5005.61 Safari: 15.5 npmPackages: @storybook/addon-essentials: 6.5.7 => 6.5.7 @storybook/addon-postcss: 2.0.0 => 2.0.0 @storybook/addon-storyshots: 6.5.7 => 6.5.7 @storybook/addon-storysource: 6.5.7 => 6.5.7 @storybook/builder-webpack5: 6.5.7 => 6.5.7 @storybook/manager-webpack5: 6.5.7 => 6.5.7 @storybook/react: 6.5.7 => 6.5.7 @storybook/testing-react: 1.3.0 => 1.3.0
Additional context N/A
It seems that EugeneDraitsev also reported this in #17985.
OK. But still suggest to support "react-test-renderer": "18.1.0"
in the plugin.
Re-open this issue until the bug has been fixed.
Is still reproducing on 6.5.8
. Also, fix with resolutions
does not seems to work
"resolutions": {
"react-test-renderer": "^18.1.0"
}
With new 6.5.9
error is still there
Setting resolutions
is just a dirty hack for only in yarn.
Should we update react-test-renderer
in package.json
?
https://github.com/storybookjs/storybook/blob/a3348bf629cbf5942a4b97ce7664531034869840/addons/storyshots/storyshots-core/package.json#L64
A related PR has been merged a couple hours ago: https://github.com/storybookjs/storybook/pull/18296; as of now, there hasn't been a new release though
The mentioned change has been released in https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.16, so I guess this could be closed?
The mentioned change has been released in https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.16, so I guess this could be closed?
I'll close it after stable version released.
I have upgraded to "@storybook/react": "^7.0.0-alpha.16",
but it still doesn’t work for me.
I patched @storybook/addon-storyshots to have
"react-test-renderer": "18.1.0"
But for some reason, it was still looking for an older version of the renderer, which was installed under @storybook/addon-storyshots/node_modules.
So I've created bash file postinstall.sh, and added the following line to remove react-test-renderer from addon-storyshots/node_modules
rm -rf node_modules/@storybook/addon-storyshots/node_modules/react-test-renderer
and then just call this file in package.json postinstall
"postinstall": "patch-package && bash ./postinstall.sh",
this solved the issue for me
Same issue for me...
Can anybody confirm if the problem is still present in the latest prerelease?
Migration guide: https://storybook.js.org/migration-guides/7.0
This issue has been solved in v7.