useLocation not work Error: Missing Router
hyoban opened this issue · 9 comments
https://github.com/hyoban/waku-router
When I run pnpm dev
from a fresh template and add useLocation
, it works fine.
But when I shut down the dev server and restart it, it doesn't work. Displays Error: Missing Router
.
Error: Missing Router
at Module.useLocation (file:///Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/waku@0.19.1_react-dom@18.3.0-canary-b30030471-20240117_react-server-dom-webpack@18.3.0-canary_gs5p533tfweocikxyqduoft2v4/node_modules/waku/dist/router/client.js:29:15)
at Counter (/Users/hyoban/Developer/Demo/waku-router/src/components/counter.tsx:13:42)
at renderWithHooks (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9532:16)
at renderIndeterminateComponent (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9611:15)
at renderElement (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9881:7)
at renderLazyComponent (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9858:3)
at renderElement (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9977:11)
at renderNodeDestructive (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:10163:13)
at retryRenderTask (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:10963:5)
at retryTask (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:10930:5)
Cannot render RSC Error: Missing Router
at Module.useLocation (file:///Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/waku@0.19.1_react-dom@18.3.0-canary-b30030471-20240117_react-server-dom-webpack@18.3.0-canary_gs5p533tfweocikxyqduoft2v4/node_modules/waku/dist/router/client.js:29:15)
at Counter (/Users/hyoban/Developer/Demo/waku-router/src/components/counter.tsx:13:42)
at renderWithHooks (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9532:16)
at renderIndeterminateComponent (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9611:15)
at renderElement (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9881:7)
at renderLazyComponent (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9858:3)
at renderElement (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:9977:11)
at renderNodeDestructive (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:10163:13)
at retryRenderTask (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:10963:5)
at retryTask (/Users/hyoban/Developer/Demo/waku-router/node_modules/.pnpm/react-dom@18.3.0-canary-b30030471-20240117_react@18.3.0-canary-b30030471-20240117/node_modules/react-dom/cjs/react-dom-server.edge.development.js:10930:5)
Is it correct that this is DEV-only issue? (pnpm build && pnpm start
has no issue, right?)
Hope someone can investigate it.
Cannot render RSC Error: Missing Router
Oh, so is it an error on server?
This issue is a bit weird, in my testing it only works if I did not use useLocation
before and have the dev server running.
Once I shut down the dev server, leaving the code unchanged, it also doesn't work.
Please try removing --with-ssr
in "dev" script in package.json and see if it changes.
Please try removing
--with-ssr
in "dev" script in package.json and see if it changes.
No error now
@Aslemammad Can you look into this? It might be similar to what you investigated before.
Sure, would like to be assigned!
working on this.