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

Update the isLoading variable to check against undefined and null values #352

Conversation

rastalamm
Copy link
Contributor

At the moment, isLoading is checking to see if there is a currentTime in order to determine whether or not to display a metric. As currentTime is declared but does not have a value (until it's passed in as a prop) it needs to be checked against undefined as well.

@@ -127,7 +127,7 @@ class XVIZMetricComponent extends PureComponent {
verticalGridLines,
getColor
} = this.props;
const isLoading = currentTime === null;
const isLoading = currentTime === null || currentTime === undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

doing currentTime == null would give the same result. http://www.ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison

I suggest this just because I myself find it bizarre to have to check 2 invalid states everywhere. Normally strict equality is preferred, but this is the one case where abstract equality is meaningful in untyped languages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The linter was complaining / auto changing it to ===. I'll switch it back to == and add in a linter rule for it.

@rastalamm
Copy link
Contributor Author

@twojtasz - updated the PR to include an in-line es lint disable rule for == and comparing to null.

@twojtasz twojtasz merged commit 06d4bed into aurora-opensource:master Jun 27, 2019
rastalamm added a commit to rastalamm/streetscape.gl that referenced this pull request Jul 8, 2019
…ues (aurora-opensource#352)

* Update the isLoading variable to check against undefined and null values

* add eslint disabling to allow for 'non strict' equality checking for this line
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.

2 participants