mirror of
https://github.com/apache/superset.git
synced 2026-04-17 15:15:20 +00:00
[sqllab] Fixed js error when results are not available (#1715)
* Fixed js error when results are not available * Flush data and query in results when running new query, keeping columns * add exception for columns * Move setState from componentWillMount to componentWillReceiveProps * Nit
This commit is contained in:
@@ -134,8 +134,10 @@ export const sqlLabReducer = function (state, action) {
|
||||
let newState = Object.assign({}, state);
|
||||
if (action.query.sqlEditorId) {
|
||||
const qe = getFromArr(state.queryEditors, action.query.sqlEditorId);
|
||||
if (qe.latestQueryId) {
|
||||
const q = Object.assign({}, state.queries[qe.latestQueryId], { results: null });
|
||||
if (qe.latestQueryId && state.queries[qe.latestQueryId]) {
|
||||
const newResults = Object.assign(
|
||||
{}, state.queries[qe.latestQueryId].results, { data: [], query: null });
|
||||
const q = Object.assign({}, state.queries[qe.latestQueryId], { results: newResults });
|
||||
const queries = Object.assign({}, state.queries, { [q.id]: q });
|
||||
newState = Object.assign({}, state, { queries });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user