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

Hydration mismatch warning in vue >=3.4 (nuxt >=3.9) if an SVG uses url(#id) #344

Open
5 tasks done
andreww2012 opened this issue Jan 30, 2024 · 3 comments
Open
5 tasks done

Comments

@andreww2012
Copy link

andreww2012 commented Jan 30, 2024

Describe the bug

Hello! I started to get hydration mismatch warnings in Vue 3.4 (Nuxt 3.9) on custom SVGs that have url(#id) expressions.

This is happening because here https://github.com/unplugin/unplugin-icons/blob/68ec8987b75537b79d5fb526d58d81b910d6a77e/src/core/svgId.ts different IDs are generated on client and server.

I'm not totally sure why this is needed, but at least having a way to disable this behavior would be nice. (Or perhaps you can now somehow make use of Nuxt 3.10's useId?)

By the way, I had an idea to patch-package the random ID generation, but was stopped by the fact that the compiled file that includes this code has a random name (chunk-...). I'm wondering why it is so?

Reproduction

https://stackblitz.com/edit/nuxt-starter-hglscy?file=assets%2Ficons%2Flogoo.svg

System Info

Doesn't matter, I believe.

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Copy link

stackblitz bot commented Jan 30, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@21stc-09
Copy link

I encountered the same problem, I roll back the vue version to 3.3.8.

perhaps because of this: vuejs/core#10011

@sardor01
Copy link

sardor01 commented Mar 10, 2024

I'm also having similar issue. @userquin can you help us with this? any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants