-
Notifications
You must be signed in to change notification settings - Fork 14k
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
[bugfix] show results in query history #6478
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6478 +/- ##
=======================================
Coverage 73.32% 73.32%
=======================================
Files 67 67
Lines 9592 9592
=======================================
Hits 7033 7033
Misses 2559 2559 Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #6478 +/- ##
=======================================
Coverage 73.32% 73.32%
=======================================
Files 67 67
Lines 9592 9592
=======================================
Hits 7033 7033
Misses 2559 2559 Continue to review full report at Codecov.
|
@youngyjd Thanks for the fix. This line was added in #5848. Auto-refresh should run periodically as along as we have queries not finished in backend. For query in rendering state, it should be finished in backend and also fetched into browser already. Not sure we should still check status of these queries in the backend? This is all available status for the lifecycle of a query. If you add a state, can you also update this set? So that this new state will be taken care by other new or existed features.
|
@graceguo-supercat Thanks for reviewing. Updates:
After I added the rendering state, it should look like:
The I am open to redesign the lifecycle of a query, but this should be in a new PR as this PR is to fix the bug without aiming to redesign a new lifecycle. What do you think? |
@@ -163,7 +171,7 @@ export default class ResultSet extends React.PureComponent { | |||
</Button> | |||
</Alert> | |||
</div>); | |||
} else if (query.state === 'success') { | |||
} else if (['rendering', 'success'].indexOf(query.state) >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If query state is changed from rendering to success, will this section get called twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And line 159, it should apply to success
instead of rendering
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. this part is called twice because of componentDidUpdate()
in ResultSet.jsx
. It is because if the state is rendering
. I am not sure how we can change the state
to success
without re-rendering
. What's your suggestion? This sound like falling into the same discussion in your comment below.
@@ -64,6 +64,14 @@ export default class ResultSet extends React.PureComponent { | |||
this.fetchResults(nextProps.query); | |||
} | |||
} | |||
componentDidUpdate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update query state here will cause whole component rerender. Is success
state really necessary? which logic depends on success state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, true, success
state is unnecessary for sqllab to show query results. However, if you navigate to Query History
after that, all historic queries' state will show rendering
instead of success
, which is not ideal right? That's why I add this componentDidUpdate()
.
@graceguo-supercat how about this? Let me try only having |
This PR is to fix a bug caused by #5848
In my local environment, I have set up running query on main database as async. This is the demo for showing results.