mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
fix(sqllab): infinite fetching status after results are landed (#25814)
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { QueryState } from '@superset-ui/core';
|
||||
import sqlLabReducer from 'src/SqlLab/reducers/sqlLab';
|
||||
import * as actions from 'src/SqlLab/actions/sqlLab';
|
||||
import { table, initialState as mockState } from '../fixtures';
|
||||
@@ -388,4 +389,38 @@ describe('sqlLabReducer', () => {
|
||||
newState = sqlLabReducer(newState, actions.refreshQueries({}));
|
||||
});
|
||||
});
|
||||
describe('CLEAR_INACTIVE_QUERIES', () => {
|
||||
let newState;
|
||||
let query;
|
||||
beforeEach(() => {
|
||||
query = {
|
||||
id: 'abcd',
|
||||
changed_on: Date.now(),
|
||||
startDttm: Date.now(),
|
||||
state: QueryState.FETCHING,
|
||||
progress: 100,
|
||||
resultsKey: 'fa3dccc4-c549-4fbf-93c8-b4fb5a6fb8b7',
|
||||
cached: false,
|
||||
};
|
||||
});
|
||||
it('updates queries that have already been completed', () => {
|
||||
newState = sqlLabReducer(
|
||||
{
|
||||
...newState,
|
||||
queries: {
|
||||
abcd: {
|
||||
...query,
|
||||
results: {
|
||||
query_id: 1234,
|
||||
status: QueryState.SUCCESS,
|
||||
data: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
actions.clearInactiveQueries(Date.now()),
|
||||
);
|
||||
expect(newState.queries.abcd.state).toBe(QueryState.SUCCESS);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user