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

EuiComboBox - only call copyInputStyles when still mounted #813

Merged
merged 3 commits into from
May 10, 2018

Conversation

nreese
Copy link
Contributor

@nreese nreese commented May 10, 2018

I am occasionally getting an error when timeout function is getting called after component has unmounted.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

Haven't tested in browser, but the code LGTM.

@@ -454,7 +454,9 @@ export class EuiComboBox extends Component {

// TODO: This will need to be called once the actual stylesheet loads.
setTimeout(() => {
this.autoSizeInput.copyInputStyles();
if (this._isMounted) {
Copy link
Contributor

Choose a reason for hiding this comment

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

A better test is probably to see if this.autoSizeInput exists rather than if this component is mounted; more future proof (e.g. if the input element is sometimes not rendered based on another prop)

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

LGTM

@nreese nreese merged commit 96ddf15 into elastic:master May 10, 2018
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.

3 participants