Skip to content

Fix race condition in EuiIcon's internal setState#3118

Merged
chandlerprall merged 2 commits intoelastic:masterfrom
chandlerprall:bug/3113-euiicon-emptiness
Mar 18, 2020
Merged

Fix race condition in EuiIcon's internal setState#3118
chandlerprall merged 2 commits intoelastic:masterfrom
chandlerprall:bug/3113-euiicon-emptiness

Conversation

@chandlerprall
Copy link
Copy Markdown
Contributor

@chandlerprall chandlerprall commented Mar 18, 2020

Summary

Fixes #3113

Reproduced the issue in the Kibana branch as described. Copied code to EUI's docs to boil it down to a basic use case, and found:

  • start with empty , which triggers a dynamic fetch for the empty icon
  • get the url for the correct icon & set the icon's type
  • img element created, network request made
  • dynamic fetch returns, setting empty back to the icon's internal state
  • icon re-renders with empty icon 😱

After making this change in EUI & confirming it fixed my simplified test case, I built EUI with the change and dropped it into the above Kibana branch, confirming it resolves the issue there too.

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

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

1 similar comment
@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks for the quick attention to this. Really appreciate it.

@chandlerprall
Copy link
Copy Markdown
Contributor Author

jenkins test this flaky test

@kibanamachine
Copy link
Copy Markdown

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

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.

👍 Thanks, @chandlerprall

@chandlerprall chandlerprall merged commit 7e70683 into elastic:master Mar 18, 2020
@chandlerprall chandlerprall deleted the bug/3113-euiicon-emptiness branch March 18, 2020 23:23
@snide
Copy link
Copy Markdown
Contributor

snide commented Mar 18, 2020

@paul-tavares Is this something you need for 7.7, or will 7.8 be ok?

@paul-tavares
Copy link
Copy Markdown

@snide yeah, we have been backporting to 7.x (currently 7.7), so if you can get it there, that would be great. Once done, I will go back to our current implementation and add back in the empty icon.
Thanks.

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.

EuiIcon fails to display SVG url path after initially being rendered with empty eui icon type

5 participants