Skip to content

Commit a0515d4

Browse files
committed
fix: debounce value
1 parent 933d640 commit a0515d4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/app/src/HDXMultiSeriesTimeChart.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,10 @@ export const MemoChart = memo(function MemoChart({
367367

368368
const [isHovered, setIsHovered] = useState(false);
369369

370-
const ChartComponent =
371-
displayType === DisplayType.StackedBar ? BarChart : AreaChart; // LineChart;
370+
const ChartComponent = useMemo(
371+
() => (displayType === DisplayType.StackedBar ? BarChart : AreaChart), // LineChart;
372+
[displayType],
373+
);
372374

373375
const lines = useMemo(() => {
374376
const hasSelection = selectedSeriesNames && selectedSeriesNames.size > 0;

packages/app/src/hooks/useAutoCompleteOptions.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
useCompleteKeyValues,
1111
useMultipleAllFields,
1212
} from '@/hooks/useMetadata';
13-
import { toArray } from '@/utils';
13+
import { toArray, useDebounce } from '@/utils';
1414

1515
export type TokenInfo = {
1616
/** The full token at the cursor position */
@@ -46,7 +46,7 @@ export interface ILanguageFormatter {
4646

4747
export function useAutoCompleteOptions(
4848
formatter: ILanguageFormatter,
49-
value: string,
49+
_value: string,
5050
{
5151
tableConnection,
5252
additionalSuggestions,
@@ -59,6 +59,7 @@ export function useAutoCompleteOptions(
5959
inputRef?: React.RefObject<HTMLTextAreaElement | null>;
6060
},
6161
) {
62+
const value = useDebounce(_value, 300);
6263
const tcs = useMemo(() => toArray(tableConnection), [tableConnection]);
6364

6465
const effectiveDateRange: [Date, Date] = useMemo(

0 commit comments

Comments
 (0)