diff --git a/frontend/src/AppBuilder/WidgetManager/widgets/numberinput.js b/frontend/src/AppBuilder/WidgetManager/widgets/numberinput.js index ba7f2bc227..b0f72e6d81 100644 --- a/frontend/src/AppBuilder/WidgetManager/widgets/numberinput.js +++ b/frontend/src/AppBuilder/WidgetManager/widgets/numberinput.js @@ -236,7 +236,7 @@ export const numberinputConfig = { }, ], exposedVariables: { - value: 99, + value: 0, isMandatory: false, isVisible: true, isDisabled: false, diff --git a/frontend/src/Editor/Components/NumberInput.jsx b/frontend/src/Editor/Components/NumberInput.jsx index 5a130bf5cc..0092893734 100644 --- a/frontend/src/Editor/Components/NumberInput.jsx +++ b/frontend/src/Editor/Components/NumberInput.jsx @@ -72,6 +72,9 @@ export const NumberInput = function NumberInput({ useEffect(() => { setInputValue(Number(parseFloat(properties.value).toFixed(properties.decimalPlaces))); + if (isNaN(Number(parseFloat(properties.value).toFixed(properties.decimalPlaces)))) { + setExposedVariable('value', null); + } // eslint-disable-next-line react-hooks/exhaustive-deps }, [properties.value]); @@ -144,6 +147,7 @@ export const NumberInput = function NumberInput({ }, clear: async function () { setInputValue(''); + setExposedVariable('value', null); fireEvent('onChange'); }, setLoading: async function (loading) { @@ -167,7 +171,8 @@ export const NumberInput = function NumberInput({ }; if (!isNaN(value)) { exposedVariables.value = value; - } + } else exposedVariables.value = null; + setExposedVariables(exposedVariables); isInitialRender.current = false; diff --git a/frontend/src/Editor/WidgetManager/configs/numberinput.js b/frontend/src/Editor/WidgetManager/configs/numberinput.js index 148754d5be..f5bc2b1490 100644 --- a/frontend/src/Editor/WidgetManager/configs/numberinput.js +++ b/frontend/src/Editor/WidgetManager/configs/numberinput.js @@ -236,7 +236,7 @@ export const numberinputConfig = { }, ], exposedVariables: { - value: 99, + value: 0, isMandatory: false, isVisible: true, isDisabled: false, diff --git a/server/src/helpers/widget-config/numberinput.js b/server/src/helpers/widget-config/numberinput.js index ba7f2bc227..b0f72e6d81 100644 --- a/server/src/helpers/widget-config/numberinput.js +++ b/server/src/helpers/widget-config/numberinput.js @@ -236,7 +236,7 @@ export const numberinputConfig = { }, ], exposedVariables: { - value: 99, + value: 0, isMandatory: false, isVisible: true, isDisabled: false,