Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useLocation not work Error: Missing Router #417

Closed
Tracked by #24
hyoban opened this issue Jan 23, 2024 · 9 comments · Fixed by #501
Closed
Tracked by #24

useLocation not work Error: Missing Router #417

hyoban opened this issue Jan 23, 2024 · 9 comments · Fixed by #501
Assignees
Labels
help wanted Extra attention is needed

Comments

@hyoban
Copy link

hyoban commented Jan 23, 2024

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)
@dai-shi
Copy link
Owner

dai-shi commented Jan 23, 2024

Is it correct that this is DEV-only issue? (pnpm build && pnpm start has no issue, right?)

Hope someone can investigate it.

@dai-shi
Copy link
Owner

dai-shi commented Jan 23, 2024

Cannot render RSC Error: Missing Router

Oh, so is it an error on server?

@dai-shi dai-shi added the help wanted Extra attention is needed label Jan 23, 2024
@hyoban
Copy link
Author

hyoban commented Jan 23, 2024

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.

@dai-shi
Copy link
Owner

dai-shi commented Jan 23, 2024

Please try removing --with-ssr in "dev" script in package.json and see if it changes.

@hyoban
Copy link
Author

hyoban commented Jan 23, 2024

Please try removing --with-ssr in "dev" script in package.json and see if it changes.

No error now

@dai-shi
Copy link
Owner

dai-shi commented Feb 9, 2024

@Aslemammad Can you look into this? It might be similar to what you investigated before.

@Aslemammad
Copy link
Contributor

Sure, would like to be assigned!

@Aslemammad
Copy link
Contributor

working on this.

@Aslemammad
Copy link
Contributor

@hyoban This should fix it #501

You can try the codesandbox build.

@dai-shi dai-shi mentioned this issue Feb 19, 2024
76 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants