1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix react error in <Icon /> 'Objects are not valid as a React child (found: object with keys {}).'

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
Hung-Han (Henry) Chen 2021-10-04 15:15:32 +03:00
parent 6a0e4d3e60
commit daed2aa64b
No known key found for this signature in database
GPG Key ID: 54B44603D251B788

View File

@ -114,14 +114,14 @@ export class Icon extends React.PureComponent<IconProps> {
}; };
// render as inline svg-icon // render as inline svg-icon
if (svg) { if (typeof svg === "string") {
const svgIconText = svg.includes("<svg") ? svg : require(`!!raw-loader!./${svg}.svg`).default; const svgIconText = svg.includes("<svg") ? svg : require(`!!raw-loader!./${svg}.svg`).default;
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }}/>; iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }}/>;
} }
// render as material-icon // render as material-icon
if (material) { if (typeof material === "string") {
iconContent = <span className="icon" data-icon-name={material}>{material}</span>; iconContent = <span className="icon" data-icon-name={material}>{material}</span>;
} }