Skip to content

Commit

Permalink
pick only from search parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed May 5, 2023
1 parent d6d279f commit 9f0c994
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import React from 'react';
import pick from 'lodash/pick';
import PropTypes from 'prop-types';
import { EditableTabs } from 'src/components/Tabs';
import { connect } from 'react-redux';
Expand Down Expand Up @@ -117,6 +118,7 @@ class TabbedSqlEditors extends React.PureComponent {
// but for some reason this data isn't being passed properly through
// the reducer.
const bootstrapData = getBootstrapData();
const queryParameters = URI(window.location).search(true);
const {
id,
name,
Expand All @@ -132,7 +134,7 @@ class TabbedSqlEditors extends React.PureComponent {
...urlParams
} = {
...bootstrapData.requested_query,
...URI(window.location).search(true),
...queryParameters,
};

// Popping a new tab based on the querystring
Expand Down Expand Up @@ -169,7 +171,7 @@ class TabbedSqlEditors extends React.PureComponent {
};
this.props.actions.addQueryEditor(newQueryEditor);
}
this.popNewTab(urlParams);
this.popNewTab(pick(urlParams, Object.keys(queryParameters)));
} else if (isNewQuery || this.props.queryEditors.length === 0) {
this.newQueryEditor();

Expand Down

0 comments on commit 9f0c994

Please sign in to comment.