From 5e8095fc98c165fb534b80ba8ab94e9b804d4396 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Mon, 11 Feb 2019 13:27:06 +0200 Subject: [PATCH 1/2] Correctly test if the current query result is for the current query. Closes #3372. --- client/app/pages/queries/view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/app/pages/queries/view.js b/client/app/pages/queries/view.js index b230ab4dc0..276feab73b 100644 --- a/client/app/pages/queries/view.js +++ b/client/app/pages/queries/view.js @@ -400,7 +400,7 @@ function QueryViewCtrl( } if (status === 'done') { - const ranSelectedQuery = $scope.query.query !== $scope.queryResult.query; + const ranSelectedQuery = $scope.query.query !== $scope.queryResult.query_result.query; if (!ranSelectedQuery) { $scope.query.latest_query_data_id = $scope.queryResult.getId(); $scope.query.queryResult = $scope.queryResult; @@ -445,6 +445,9 @@ function QueryViewCtrl( $scope.saveQuery().then((query) => { // Because we have a path change, we need to "signal" the next page to // open the visualization editor. + // TODO: we don't really need this. Just need to assign query to $scope.query + // and maybe a few more small changes. Not worth handling this now, but also + // we shouldn't copy this bizzare method to the React codebase. $location.path(query.getSourceLink()).hash('add'); }); } else { From d80d81ea22674ab2ca2e7d04abdb0eee9b661bf8 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Mon, 11 Feb 2019 13:27:17 +0200 Subject: [PATCH 2/2] Serialize a new query with its visualizations. --- redash/handlers/queries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redash/handlers/queries.py b/redash/handlers/queries.py index bd43c69576..0fc867ae8e 100644 --- a/redash/handlers/queries.py +++ b/redash/handlers/queries.py @@ -228,7 +228,7 @@ def post(self): 'object_type': 'query' }) - return QuerySerializer(query).serialize() + return QuerySerializer(query, with_visualizations=True).serialize() class QueryArchiveResource(BaseQueryListResource):