KyleAMathews/react-gravatar

No `react-gravatar` class

Closed this issue · 1 comments

Hey, I’m using 2.3.0 with react@0.14.7 and Babel 5 (too lazy to upgrade now). It seems that this:

<img
    style={@props.style}
    className={"react-gravatar " + @props.className}
    src={src}
    srcSet={retinaSrc + " 2x"}
    height={@props.size}
    width={@props.size}
    {...@props}
    />

Is compiled to this:

return React.createElement("img", React.__spread({
        "style": this.props.style,
        "className": "react-gravatar " + this.props.className,
        "src": src,
        "srcSet": retinaSrc + " 2x",
        "height": this.props.size,
        "width": this.props.size
      }, this.props));

With React.__spread being Object.assign, which means that className is overwritten by the default className of the empty string.

var props = { className: '', email: 'foo' }
undefined
> Object.assign({ className: "default " + props.className}, props)
{ className: '', email: 'foo' }

Ooops! Thanks for that catch. Published 2.3.1 with fix.