Fix visibility and disable variables naming conventions

This commit is contained in:
Nakul Nagargade 2025-03-12 11:26:05 +05:30
parent 13c2e4485d
commit 50711e9600

View file

@ -236,8 +236,6 @@ export const TextInput = function TextInput({
value: properties.value,
isMandatory: isMandatory,
isLoading: loading,
isVisible: visibility,
isDisabled: disable,
};
setExposedVariables(exposedVariables);
@ -245,6 +243,17 @@ export const TextInput = function TextInput({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
// Fix for "visibility is not defined" in production because there's a naming conflict in the code.
// The issue is in the exposedVariables object where we had both a function named visibility and a property isVisible that depends on the state variable with the same name.
const exposedVariables = {
isVisible: visibility,
isDisabled: disable,
};
setExposedVariables(exposedVariables);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const setInputValue = (value) => {
setValue(value);
setExposedVariable('value', value);