Hello guys!
I just noticed that there's a little bug on the EuiIcon component, as a this.setState is called too early in the process, yielding the following console error : Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to 'this.state' directly or define a 'state = {};' class property with the desired state in the EuiIcon component.
Looking at the codebase, the problem lies in the component constructor on l.594 where loadIconComponent is called, triggering the setState on l.635
I don't have much background in this library, but from what I see you're building an icon cache for every EuiIcon that gets spawned, to improve rendering performance of other EuiIcons with the same iconType? If that is so, I think moving the problematic code to componentDidMount would fix the problem without breaking much things.
I'm sorry that I don't have the time to open a PR 😔
Hello guys!
I just noticed that there's a little bug on the
EuiIconcomponent, as athis.setStateis called too early in the process, yielding the following console error :Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to 'this.state' directly or define a 'state = {};' class property with the desired state in the EuiIcon component.Looking at the codebase, the problem lies in the component constructor on l.594 where
loadIconComponentis called, triggering thesetStateon l.635I don't have much background in this library, but from what I see you're building an icon cache for every
EuiIconthat gets spawned, to improve rendering performance of otherEuiIcons with the sameiconType? If that is so, I think moving the problematic code tocomponentDidMountwould fix the problem without breaking much things.I'm sorry that I don't have the time to open a PR 😔