Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -588,23 +588,31 @@ export class EuiIcon extends PureComponent<EuiIconProps, State> {

const { type } = props;
const initialIcon = getInitialIcon(type);
let isLoading = false;

if (isEuiIconType(type) && initialIcon == null) {
isLoading = true;
this.loadIconComponent(type);
} else {
this.onIconLoad();
}

this.state = {
icon: initialIcon,
iconTitle: undefined,
isLoading,
neededLoading: isLoading,
isLoading: false,
neededLoading: false,
};
}

componentDidMount() {
const { type } = this.props;

if (isEuiIconType(type) && this.state.icon == null) {
//eslint-disable-next-line react/no-did-mount-set-state
this.setState({
neededLoading: true,
isLoading: true,
});

this.loadIconComponent(type);
} else {
this.onIconLoad();
}
}

componentDidUpdate(prevProps: EuiIconProps) {
const { type } = this.props;
if (type !== prevProps.type) {
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/5899.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed `EuiIcon` from producing console warning in `React.StrictMode`