diff --git a/client/app/components/Parameters.jsx b/client/app/components/Parameters.jsx
index 22dfe5765a..b4c52d2950 100644
--- a/client/app/components/Parameters.jsx
+++ b/client/app/components/Parameters.jsx
@@ -51,11 +51,13 @@ export class Parameters extends React.Component {
componentDidUpdate = prevProps => {
const { parameters, disableUrlUpdate } = this.props;
- if (prevProps.parameters !== parameters) {
+ const parametersChanged = prevProps.parameters !== parameters;
+ const disableUrlUpdateChanged = prevProps.disableUrlUpdate !== disableUrlUpdate;
+ if (parametersChanged) {
this.setState({ parameters });
- if (!disableUrlUpdate) {
- updateUrl(parameters);
- }
+ }
+ if ((parametersChanged || disableUrlUpdateChanged) && !disableUrlUpdate) {
+ updateUrl(parameters);
}
};
diff --git a/client/app/pages/queries/QuerySource.jsx b/client/app/pages/queries/QuerySource.jsx
index e7a62d0454..bf72fdc43d 100644
--- a/client/app/pages/queries/QuerySource.jsx
+++ b/client/app/pages/queries/QuerySource.jsx
@@ -1,5 +1,5 @@
import { isEmpty, find, map, extend, includes } from "lodash";
-import React, { useState, useRef, useEffect, useMemo, useCallback } from "react";
+import React, { useState, useRef, useEffect, useCallback } from "react";
import PropTypes from "prop-types";
import { react2angular } from "react2angular";
import { useDebouncedCallback } from "use-debounce";
@@ -149,16 +149,10 @@ function QuerySource(props) {
}
}, []);
- const canExecuteQuery = useMemo(() => queryFlags.canExecute && !isQueryExecuting && !areParametersDirty, [
- isQueryExecuting,
- areParametersDirty,
- queryFlags.canExecute,
- ]);
-
const [selectedText, setSelectedText] = useState(null);
const doExecuteQuery = useCallback(() => {
- if (!canExecuteQuery) {
+ if (!queryFlags.canExecute || isQueryExecuting) {
return;
}
if (isDirty || !isEmpty(selectedText)) {
@@ -166,7 +160,7 @@ function QuerySource(props) {
} else {
executeQuery();
}
- }, [canExecuteQuery, isDirty, selectedText, executeQuery, executeAdhocQuery]);
+ }, [queryFlags.canExecute, isQueryExecuting, isDirty, selectedText, executeQuery, executeAdhocQuery]);
return (
@@ -183,24 +177,31 @@ function QuerySource(props) {