Skip to content

Commit

Permalink
Fix auto query selection behavior (pinterest#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
czgu authored Mar 30, 2021
1 parent e3f9edc commit c2aaf9a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ export const DataDocQueryExecutions: React.FunctionComponent<IProps> = React.mem
dispatch(queryExecutionsActions.fetchQueryExecutionsByCell(cellId));
}, [cellId]);

React.useEffect(() => {
useEffect(() => {
selectExecutionIndex(0);
}, [queryExecutions.length]);

const [usedQueryParam, setUsedQueryParam] = useState(false);
useEffect(() => {
if (!usedQueryParam) {
if (!usedQueryParam && queryExecutions.length) {
const queryParam = getQueryString();
if ('executionId' in queryParam && queryParam['executionId']) {
const executionId = Number(queryParam['executionId']);
Expand All @@ -87,10 +87,10 @@ export const DataDocQueryExecutions: React.FunctionComponent<IProps> = React.mem
] of queryExecutions.entries()) {
if (queryExecution.id === executionId) {
selectExecutionIndex(index);
setUsedQueryParam(true);
}
}
}
setUsedQueryParam(true);
}
}, [queryExecutions, usedQueryParam]);

Expand Down

0 comments on commit c2aaf9a

Please sign in to comment.