mirror of https://github.com/apache/superset.git
fix: SQL Lab show "Refetch Results" button while fetching new query results (#15109)
* fix: SQL Lab show "Refetch Results" button while fetching new query results * fix comments
This commit is contained in:
parent
91e424bbb4
commit
408d58f937
|
@ -517,7 +517,20 @@ export default function sqlLabReducer(state = {}, action) {
|
|||
if (changedQuery.changedOn > queriesLastUpdate) {
|
||||
queriesLastUpdate = changedQuery.changedOn;
|
||||
}
|
||||
newQueries[id] = { ...state.queries[id], ...changedQuery };
|
||||
const prevState = state.queries[id].state;
|
||||
const currentState = changedQuery.state;
|
||||
newQueries[id] = {
|
||||
...state.queries[id],
|
||||
...changedQuery,
|
||||
// race condition:
|
||||
// because of async behavior, sql lab may still poll a couple of seconds
|
||||
// when it started fetching or finished rendering results
|
||||
state:
|
||||
currentState === 'success' &&
|
||||
['fetching', 'success'].includes(prevState)
|
||||
? prevState
|
||||
: currentState,
|
||||
};
|
||||
change = true;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue