react: hydrate SVG error: Expected server HTML to contain a matching in
Do you want to request a feature or report a bug?
bug
What is the current behavior?
It seems like ReactDOM.hydrate doesn’t play nice with certain kinds of inline SVGs.
Specifically ones that have clipPaths
When nextjs tries calling hydrate on a page with one of these SVGs, the offending part of the svg flashes quickly then react throws this error to the console.
Expected server HTML to contain a matching <clipPath> in <svg>.
I have a very small example of this happening here https://github.com/Delray-Devs/site/tree/brokenSVG
The strange part is when next builds the site statically it all works.
I originally opened this issue on zeit/nextjs, but @timneutkens suggested I open the issue here.
See https://github.com/zeit/next.js/issues/9871 for all the details.
What is the expected behavior?
The SVG containing the clipPath gets rendered correctly on the client side.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React: 16.12, not sure about previous versions Browser: Firefox and Chrome OS: macOS
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15 (2 by maintainers)
I had the same issue and solved it with a
hasMountedhook.This fixes it, but, the icon will show after the first render, which is not ideal