fix: convert stringified numbers to Number before making http request

This commit is contained in:
abdou6666 2024-12-13 18:32:34 +01:00
parent 9a3165f8da
commit dd4ad54d58

View File

@ -133,8 +133,14 @@ export const Settings = () => {
useEffect(() => {
const subscription = watch((values, { name }) => {
const [group, label] = (name as string).split(".");
const currentSettingValue = values[group][label] as any;
// if setting value is Number but typed string convert it to number
const settingValue =
typeof values[group][label] === "string" && isNaN(currentSettingValue)
? values[group][label]
: Number(values[group][label]);
debouncedUpdate(group, label, values[group][label]);
debouncedUpdate(group, label, settingValue);
});
return () => {