Skip to content

Add caching layer to EuiIcon#3404

Merged
chandlerprall merged 4 commits intoelastic:masterfrom
chandlerprall:feature/3393-euiicon-caching
Apr 30, 2020
Merged

Add caching layer to EuiIcon#3404
chandlerprall merged 4 commits intoelastic:masterfrom
chandlerprall:feature/3393-euiicon-caching

Conversation

@chandlerprall
Copy link
Copy Markdown
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

@chandlerprall chandlerprall force-pushed the feature/3393-euiicon-caching branch from b34b2cf to 836bd84 Compare April 29, 2020 15:28
@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown
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
Copy Markdown

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

Copy link
Copy Markdown
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
Copy Markdown

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