-
Notifications
You must be signed in to change notification settings - Fork 858
Description
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 EuiIcon
s 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 😔