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

something about router and hydration #19280

Closed
j4tmr opened this issue Feb 25, 2023 · 1 comment
Closed

something about router and hydration #19280

j4tmr opened this issue Feb 25, 2023 · 1 comment

Comments

@j4tmr
Copy link

j4tmr commented Feb 25, 2023

Environment


  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.2.2
  • Nitro Version: 2.2.3
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-f5czk5

Describe the bug

  1. hydration problem when server side content has '\r' in it, when origin text is "a \r\n\r\n b \r\n\r\n c"
  • Client: " a \n\n b \n\n c"
  • Server: " a \r\n\r\n b \r\n\r\n c"
  1. router priority
    The priority of static router should be higher than the dynamic route. There are more complex issues when the parameters in the route are more complex in the route.
    Like the example in https://stackblitz.com/edit/github-f5czk5
    Example:
├─[p1]-[p2]-page
├─p-[p1]-page
├─p-p-[p1]-page

When i visit p-p-p2-page, i will not go to the p-p-[p1]-page but p-[p1]-page.
This may not be a bug, but there needs to be a mechanism to prioritize auto-generated links, and with complex routing, there are more of these issues.

  1. the issue i made several days ago #18938
    After update into new version
    Two of the router
├─parent/page
├─parent-page

will create same router name and return a warning.

 WARN  [nuxt] Route name generated for/parent/page.vue is the same as /pages/parent-page.vue. You may wish to set a custom name using definePageMeta within the page file.

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

danielroe commented Feb 27, 2023

In your first issue, the hydration issues are likely an upstream Vue SSR issue, similar to vuejs/core#6410. I would suggest creating an issue there.

For the second, you can pass a custom route in definePageMeta that lets you use all the custom validators from vue-router: https://router.vuejs.org/guide/essentials/route-matching-syntax.html#custom-regex-in-params.

For the third comment, this is now desired behaviour. As suggested in the log, you should define a name within definePageMeta, as Nuxt does not have enough information to decide which one should be named parent-page.

(One comment - in future, I suggest creating individual issues as this is more helpful to maintainers - issues may have separate causes and fixes.)

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants