From 239fb230c65b7c6109cfcaff837c4831b0a0e0c3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 31 Mar 2024 23:11:53 -0300 Subject: [PATCH] Update parameterUtils to use debounce instead of throttle --- .../GenericNode/components/parameterComponent/index.tsx | 6 +++--- src/frontend/src/utils/parameterUtils.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index e068714ad..6a5029101 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -34,8 +34,8 @@ import { } from "../../../../types/api"; import { ParameterComponentType } from "../../../../types/components"; import { + debouncedHandleUpdateValues, handleUpdateValues, - throttledHandleUpdateValues, } from "../../../../utils/parameterUtils"; import { convertObjToArray, @@ -170,7 +170,7 @@ export default function ParameterComponent({ if (shouldUpdate) { setIsLoading(true); try { - newTemplate = await throttledHandleUpdateValues(name, data); + newTemplate = await debouncedHandleUpdateValues(name, data); } catch (error) { let responseError = error as ResponseErrorTypeAPI; setErrorData({ @@ -662,7 +662,7 @@ export default function ParameterComponent({ ) : left === true && type === "int" ? (
{ } }; -export const throttledHandleUpdateValues = throttle(handleUpdateValues, 10); +export const debouncedHandleUpdateValues = debounce(handleUpdateValues, 200);