exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework
https://ultrajs.dev
MIT License
2.99k stars 65 forks source link

Error reported after join react-redux #246

Closed llqfront closed 1 year ago

llqfront commented 1 year ago
[ultra] - INFO   <-- GET /
Hello world!
[ultra] - ERROR TypeError: Cannot read properties of null (reading 'useMemo')
    at n.useMemo (https://esm.sh/stable/react@18.2.0/deno/react.js:2:6617)
    at it (https://esm.sh/v108/react-redux@8.0.5/deno/react-redux.js:6:568)
    at renderWithHooks (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:9779:24)
    at renderIndeterminateComponent (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:9836:23)
    at renderElement (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:9996:15)
    at renderNodeDestructiveImpl (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:10101:17)
    at renderNodeDestructive (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:10081:22)
    at renderIndeterminateComponent (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:9876:15)
    at renderElement (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:9996:15)
    at renderNodeDestructiveImpl (https://esm.sh/v108/react-dom@18.2.0/deno/server.development.js:10101:17)
Trace: Cannot read properties of null (reading 'useMemo')
    at errorHandler (https://deno.land/x/hono@v2.5.1/hono.ts:107:13)
    at https://deno.land/x/hono@v2.5.1/compose.ts:68:29
    at async https://deno.land/x/ultra@v2.2.1/lib/middleware/serveStatic.ts:67:7
    at async https://deno.land/x/ultra@v2.2.1/lib/middleware/serveStatic.ts:67:7
    at async https://deno.land/x/hono@v2.5.1/middleware/logger/index.ts:65:5
    at async https://deno.land/x/hono@v2.5.1/hono.ts:239:50
    at async Server.#respond (https://deno.land/std@0.176.0/http/server.ts:299:18)
thomascarvalho commented 1 year ago

Most of the time this is a version conflict.

You can specify react as external if you're using esm.sh, that should solve your issue

eg on importMap.json:

"react-redux": "https://esm.sh/react-redux@8.0.5?external=react",
"@reduxjs/toolkit": "https://esm.sh/@reduxjs/toolkit@1.9.3?external=react",
llqfront commented 1 year ago

Most of the time this is a version conflict.

You can specify react as external if you're using esm.sh, that should solve your issue

eg on importMap.json:

"react-redux": "https://esm.sh/react-redux@8.0.5?external=react",
"@reduxjs/toolkit": "https://esm.sh/@reduxjs/toolkit@1.9.3?external=react",

I've switched to other issues, but I still can't get it to work. What do you use for state management when you use ultra? Don't you use redux? Or is there something else you can recommend?

llqfront commented 1 year ago

Most of the time this is a version conflict.

You can specify react as external if you're using esm.sh, that should solve your issue

eg on importMap.json:

"react-redux": "https://esm.sh/react-redux@8.0.5?external=react",
"@reduxjs/toolkit": "https://esm.sh/@reduxjs/toolkit@1.9.3?external=react",

Well, because of my introduction path problem Also, I used recoil, which is also OK. Thank you very much