Skip to content

Commit

Permalink
refactor(results): updated datasource to not call api when useTimeRan…
Browse files Browse the repository at this point in the history
…geFor is undefined

Signed-off-by: Ahalya Radhakrishnan <ahalya.radhakrishnan@ni.com>
  • Loading branch information
Ahalya-ni committed Jan 31, 2025
1 parent 6dbf488 commit a2646b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/datasources/results/components/ResultsQueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ export function ResultsQueryEditor({ query, onChange, onRunQuery, datasource }:
query = datasource.prepareQuery(query);

const handleQueryChange = useCallback(
(query: ResultsQuery, runQuery?: boolean): void => {
(query: ResultsQuery, runQuery = true): void => {
onChange(query);
runQuery = runQuery !== undefined ? runQuery : true;
console.log('runQuery', runQuery);
if (runQuery) {
console.log('called onRunQuery');
onRunQuery();
}
},[onChange, onRunQuery]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export function QueryResultsEditor({ query, handleQueryChange }: Props) {

const onUseTimeRangeChecked = (value: boolean) => {
if(query.useTimeRangeFor === undefined) {
console.log('should not called');
handleQueryChange({ ...query, useTimeRange: value }, false);
return;
}
handleQueryChange({ ...query, useTimeRange: value });
};
Expand Down

0 comments on commit a2646b9

Please sign in to comment.