Skip to content

Commit

Permalink
Moved query sanitization inside the useDashboards hook
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen5959 authored and praveen5959 committed Nov 8, 2024
1 parent b23600d commit f8169f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useDashboards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
UpdateDashboardType,
} from '@/@types/parseable/api/dashboards';
import { useSearchParams } from 'react-router-dom';
import { sanitiseSqlString } from '@/utils/sanitiseSqlString';

const { setDashboards, setTileData, selectDashboard } = dashboardsStoreReducers;

Expand Down Expand Up @@ -156,10 +157,10 @@ export const useTileQuery = (opts: {
const [, setDashboardsStore] = useDashboardsStore((_store) => null);
const { query, startTime, endTime, tileId, enabled = true } = opts;
const { isLoading, isFetching, isError, refetch } = useQuery(
[tileId, query, startTime, endTime],
[tileId, startTime, endTime],
() =>
getQueryData({
query,
query: sanitiseSqlString(query, false, 100),
startTime,
endTime,
}),
Expand Down

0 comments on commit f8169f2

Please sign in to comment.