storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[@storybook/addon-storyshots] Please upgrade the `react-test-renderer` version to v18.1.0 in`addon-storyshots`

Open NeoLSN opened this issue 2 years ago • 10 comments

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

  1. Using react-v18 and following instructions of the document on @storybook/addon-storyshots.
  2. 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

NeoLSN avatar Jun 08 '22 02:06 NeoLSN

It seems that EugeneDraitsev also reported this in #17985.

vojkog avatar Jun 10 '22 06:06 vojkog

OK. But still suggest to support "react-test-renderer": "18.1.0" in the plugin.

NeoLSN avatar Jun 13 '22 06:06 NeoLSN

Re-open this issue until the bug has been fixed.

NeoLSN avatar Jun 13 '22 06:06 NeoLSN

Is still reproducing on 6.5.8. Also, fix with resolutions does not seems to work

"resolutions": {
  "react-test-renderer": "^18.1.0"
}

arthurzakharov-zz avatar Jun 13 '22 11:06 arthurzakharov-zz

With new 6.5.9 error is still there

arthurzakharov-zz avatar Jun 14 '22 08:06 arthurzakharov-zz

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

sys9kdr avatar Jun 21 '22 03:06 sys9kdr

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

mvarendorff avatar Jul 11 '22 18:07 mvarendorff

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?

mvarendorff avatar Jul 26 '22 06:07 mvarendorff

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.

NeoLSN avatar Aug 03 '22 10:08 NeoLSN

I have upgraded to "@storybook/react": "^7.0.0-alpha.16", but it still doesn’t work for me.

aliceathens avatar Oct 13 '22 19:10 aliceathens

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

trizerr avatar Jan 05 '23 09:01 trizerr

Same issue for me...

NuiceT avatar Feb 15 '23 10:02 NuiceT

Can anybody confirm if the problem is still present in the latest prerelease?

Migration guide: https://storybook.js.org/migration-guides/7.0

shilman avatar Feb 21 '23 07:02 shilman

This issue has been solved in v7.

NeoLSN avatar Jul 06 '23 05:07 NeoLSN