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

[SQL Lab] Fix proptypes warning #7691

Merged

Conversation

etr2460
Copy link
Member

@etr2460 etr2460 commented Jun 11, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

Cleans up this console warning:
Screen Shot 2019-06-11 at 11 12 56 AM

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

CI

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@graceguo-supercat

@@ -308,7 +308,7 @@ class SqlEditor extends React.PureComponent {
</div>
<SouthPane
editorQueries={this.props.editorQueries}
latestQueryId={this.props.latestQuery ? this.props.latestQuery.id : 0}
latestQueryId={this.props.latestQuery && this.props.latestQuery.id}
Copy link

@graceguo-supercat graceguo-supercat Jun 12, 2019

Choose a reason for hiding this comment

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

for brand new sql lab (no any query before, or user clears localStorage), the latestQuery object will be null. Is latestQueryId assigned false? To fix this, i think should change 0 be any string like '' or 'none' ?

Copy link
Member Author

Choose a reason for hiding this comment

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

null && something_invalid resolves to null, so I think this is fine. It makes more sense for latestQueryId to be null if no query exists instead of something like empty string (i think)

Choose a reason for hiding this comment

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

null is object type? The expected type is string.

Copy link
Member Author

@etr2460 etr2460 Jun 12, 2019

Choose a reason for hiding this comment

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

The expected type is string, not required, so null is fine right? I wasn't seeing any prop type errors anymore so i think it's ok

Choose a reason for hiding this comment

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

oh just realized latestQueryId is optional. LGTM thanks!!

Copy link

@graceguo-supercat graceguo-supercat left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -308,7 +308,7 @@ class SqlEditor extends React.PureComponent {
</div>
<SouthPane
editorQueries={this.props.editorQueries}
latestQueryId={this.props.latestQuery ? this.props.latestQuery.id : 0}
latestQueryId={this.props.latestQuery && this.props.latestQuery.id}

Choose a reason for hiding this comment

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

oh just realized latestQueryId is optional. LGTM thanks!!

@graceguo-supercat graceguo-supercat merged commit 2a453e1 into apache:master Jun 13, 2019
@etr2460 etr2460 deleted the erik-ritter--sqllab-js-warning branch June 13, 2019 17:04
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants