vikejs / vike-react

🔨 React integration for Vike
https://vike.dev/vike-react
MIT License
94 stars 15 forks source link

routeParams did not pass on the client-side by default #104

Closed zhy0216 closed 4 months ago

zhy0216 commented 4 months ago

on doc it mentioned it should: https://vike.dev/passToClient#default

brillout commented 4 months ago

Indeed it should.

I cannot reproduce. Can you publish a minimal reproduction? I'll re-open then.

zhy0216 commented 4 months ago

Hi @brillout, if you can go to minimal example in this repo, and use pageContext.routeParams in the +Page. Then open dev tool in browser then you can see the following errors.

Screenshot 2024-04-16 at 16 14 55
brillout commented 4 months ago

It's because the page doesn't have any route parameters. That said, the error is misleading and should be improved. Labeling this as bug.

brillout commented 4 months ago

pageContext.routeParams is now always passed regardless of whether the page has a route parameter.