mirror of
https://github.com/apache/superset.git
synced 2026-04-21 09:04:38 +00:00
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:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user