From 655834b25c957dd8fb576f8b2c1f803dfc394639 Mon Sep 17 00:00:00 2001 From: "Hugh A. Miles II" Date: Wed, 16 Dec 2020 21:59:46 -0500 Subject: [PATCH] fix: Fix "View in SQLLab" bug (#12086) --- .../src/SqlLab/components/TabbedSqlEditors.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx b/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx index f0f6d4859f..fe8b5d0d75 100644 --- a/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx +++ b/superset-frontend/src/SqlLab/components/TabbedSqlEditors.jsx @@ -116,8 +116,15 @@ class TabbedSqlEditors extends React.PureComponent { } // merge post form data with GET search params + // Hack: this data should be comming from getInitialState + // but for some reason this data isn't being passed properly through + // the reducer. + const appContainer = document.getElementById('app'); + const bootstrapData = JSON.parse( + appContainer?.getAttribute('data-bootstrap') || '{}', + ); const query = { - ...this.props.requestedQuery, + ...bootstrapData.requested_query, ...URI(window.location).search(true), };