Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons not loading when page loads #6099

Closed
silverview7 opened this issue Aug 3, 2022 · 7 comments · Fixed by #6166
Closed

Icons not loading when page loads #6099

silverview7 opened this issue Aug 3, 2022 · 7 comments · Fixed by #6166

Comments

@silverview7
Copy link

Hi all,

I've been facing an issue where for example I am using the EuiFieldText or EuiDatePicker and the icons don't load in. Instead there's a grey box in place of where the icon should be.
gitelasticuiload

Not sure whether its the way I'm implementing it or if its a known issue.

@miukimiu
Copy link
Contributor

miukimiu commented Aug 3, 2022

Hi @silverview7,

It seems that is something wrong with the way you're setting up EUI. Are you following these instructions?

https://eui.elastic.co/#/guidelines/getting-started#setting-up-your-application

@thompsongl
Copy link
Contributor

Could also be related to #5463 if you are not using webpack to bundle your app.

@silverview7
Copy link
Author

Using import { appendIconComponentCache } from '@elastic/eui/es/components/icon/icon'; then caching my needed icons fixed the issue

@thompsongl thompsongl added the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Aug 8, 2022
@github-actions
Copy link

👋 This issue hasn't seen activity in 3 days, so we're automatically closing this issue as answered. Please leave a comment if that's not the case, or if you have any remaining questions or issues.

@RickoNoNo3
Copy link

I incidentally discovered today that as long as the StrictMode is not opened, EuiIcon can be loaded correctly. However, React is officially recommended that to completely follow the strict mode requirements to avoid unknown BUGs, so it is a bit uncomfortable.

I'm not used to close the StrictMode, but now I have to.

@silverview7
Copy link
Author

@RickoNoNo3 That's a great solution, and honestly better than caching all the icons individually. It's also fixed some other strange behaviors I have noticed while using this UI. Thing is StrictMode isnt used in production anyways so shouldn't be to big of a deal, as long as precautions are taken.

@chandlerprall chandlerprall removed the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Aug 22, 2022
@chandlerprall chandlerprall reopened this Aug 22, 2022
@chandlerprall
Copy link
Contributor

We've had an internal report of icons not loading, and I've now reproduced in a fresh create-react-app in which our icons don't load. Looks like it is related to how strict mode changes React's rendering; I have a fix that works for create-react-app and will put up a PR once we confirm it fixes our internal case as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants