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

Add caching layer to EuiIcon #3404

Merged

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Apr 29, 2020

Summary

Fixes #3393

Added a caching layer and some other logic to avoid fading in icons when they are immediately renderable.

  • Added a caching layer to EuiIcon and an exported function to clear one-or-all of the cache entries
  • Removed the euiIcon-isLoaded class when an icon is immediately renderable, removing the fade-in animation on cached icons or when a custom component is provided
  • Single snapshot touched, proving the non-fade-in for custom components

The various update paths for the icon's state is definitely a mess. Everything's working, rendering, and snapshotting as expected but the next time the maze is touched it should be documented & refactored.

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox
- [ ] Props have proper autodocs
- [ ] Added documentation examples

  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3404/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉
Ran jest tests a few times with no surprises.
Spot-checked EUI docs examples, page transitions for visual flicker without surprises.
LGTM

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3404/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally works for me 👍

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3404/

@chandlerprall chandlerprall merged commit cc6040b into elastic:master Apr 30, 2020
@chandlerprall chandlerprall deleted the feature/3393-euiicon-caching branch April 30, 2020 18:10
@snide snide mentioned this pull request Apr 30, 2020
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 this pull request may close these issues.

Icons should be cached to avoid flickering on render
4 participants