diff --git a/packages/web/src/components/ControlledCustomAutocomplete/index.jsx b/packages/web/src/components/ControlledCustomAutocomplete/index.jsx index 874ee6a9..9e36dbb6 100644 --- a/packages/web/src/components/ControlledCustomAutocomplete/index.jsx +++ b/packages/web/src/components/ControlledCustomAutocomplete/index.jsx @@ -61,6 +61,7 @@ function ControlledCustomAutocomplete(props) { const [isSingleChoice, setSingleChoice] = React.useState(undefined); const priorStepsWithExecutions = React.useContext(StepExecutionsContext); const editorRef = React.useRef(null); + const mountedRef = React.useRef(false); const renderElement = React.useCallback( (props) => , @@ -94,10 +95,14 @@ function ControlledCustomAutocomplete(props) { }, []); React.useEffect(() => { - const hasDependencies = dependsOnValues.length; - if (hasDependencies) { - // Reset the field when a dependent has been updated - resetEditor(editor); + if (mountedRef.current) { + const hasDependencies = dependsOnValues.length; + if (hasDependencies) { + // Reset the field when a dependent has been updated + resetEditor(editor); + } + } else { + mountedRef.current = true; } }, dependsOnValues);