johnf / storybook-addon-jotai

MIT License
6 stars 10 forks source link

jotai version 2 #16

Open leedoopal opened 1 year ago

leedoopal commented 1 year ago

Hi, I'm enjoying your plugin. The jotai version has been upgraded to 2, do you have any thoughts on doing this?

leedoopal commented 1 year ago

@johnf What do you think?

johnf commented 1 year ago

sorry, it's been on my list too look at, hopefully I'll get to it in the next few weeks. What issues do you see when using v2?

leedoopal commented 1 year ago

No. Thanks for the answer :)

In jotai v2, useAtomValue, which was under 'jotai/utils', was moved to 'jotai' (root). https://github.com/pmndrs/jotai/blob/main/src/react.ts

// error
caught TypeError: (0 , jotai_utils__WEBPACK_IMPORTED_MODULE_3__.useAtomValue) is not a function

So in my code now, I get the error at the bottom. because there is no useAtomValue in jotai/utils. https://github.com/johnf/storybook-addon-jotai/blob/4084b622b909acfb1aaa77c49deec699eb0b64e0/src/index.tsx#L10