formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
110 stars 3 forks source link

useResponsiveClientValue is throwing error without used in Nextjs 13 #135

Closed mmailaender closed 1 year ago

mmailaender commented 1 year ago

I am using Nextjs 13 with the App directory.

It seems the new useResponsiveClientValue hook is throwing an error. I'm not using it yet, but when upgrading to v1.13, it starts throwing the error.

Uncaught TypeError: react_1.default.createContext is not a function
    at eval (webpack-internal:///(/sc_server)/./node_modules/reshaped/dist/hooks/_private/useSingletonEnvironment.js:13:55)
    at Object.(sc_server)/./node_modules/reshaped/dist/hooks/_private/useSingletonEnvironment.js (/evalmachine.<anonymous>:2951:1)
    at __webpack_require__ (/evalmachine.<anonymous>:37:33)
    at fn (/evalmachine.<anonymous>:311:21)
    at eval (webpack-internal:///(/sc_server)/./node_modules/reshaped/dist/hooks/useResponsiveClientValue.js:11:35)
    at Object.(sc_server)/./node_modules/reshaped/dist/hooks/useResponsiveClientValue.js (/evalmachine.<anonymous>:3006:1)
    at __webpack_require__ (/evalmachine.<anonymous>:37:33)
    at fn (/evalmachine.<anonymous>:311:21)
    at eval (webpack-internal:///(/sc_server)/./node_modules/reshaped/dist/index.js:375:34)
    at Object.(sc_server)/./node_modules/reshaped/dist/index.js (/evalmachine.<anonymous>:3050:1)
blvdmitry commented 1 year ago

I'll ship a patch for this. I think I've merged the hook after the review of the codebase for RSC. Don't have a separate playground within the repo for server components so missed this, sorry.

Gonna patch the existing release

mmailaender commented 1 year ago

Thx, can you ping me when it's available? :)

blvdmitry commented 1 year ago

@mmailaender I've added "use client" and updated it in 1.13, can you try it out?

mmailaender commented 1 year ago

Works, thx :)