Skip to content

<svg> with linearGradient produces server side rendering warning #11354

@lzcabrera

Description

@lzcabrera

This is a report for a bug of a server side rendering warning when using svgs in React 16

What is the current behavior?
We get the following warning when using an svg tag with a linearGradient attribute in one of our components:

Warning: Expected server HTML to contain a matching <linearGradient> in <defs>.

Since this is a server side warning, we have reproduced the warning on this repo with a very simple example of an svg tag:
https://github.com/lzcabrera/svg-SSR

Steps to reproduce

  • clone repo
  • npm install
  • npm build
  • npm start
  • Visit http://localhost:3000 on your browser
  • Open the javascript console to see the warning

What is the expected behavior?
The expected behaviour is to have no warning when doing server side rendering, just like there is none when rendering on the client side.

This worked in React 15.6.1 as tested on branch v15 on the same repo above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions