diff --git a/src/components/StateDropdown.tsx b/src/components/StateDropdown.tsx index 9d89e562c..7597c3adf 100644 --- a/src/components/StateDropdown.tsx +++ b/src/components/StateDropdown.tsx @@ -29,19 +29,15 @@ export const StateDropdown = React.forwardRef { - const defaultState = flow?.states?.filter((s) => s?.default)[0]; - if (!value && defaultState) { - setState(defaultState); - onChange?.(defaultState); - } - }, [value, onChange, flow]); + const flow = defaultFlowEnabled ? defaultFlow : flowById; const onStateChange = useCallback( (s: Partial) => { @@ -51,6 +47,12 @@ export const StateDropdown = React.forwardRef { + if (value) return; + const defaultState = flow?.states.find((state) => state.default === true); + defaultState && onStateChange(defaultState); + }, [flow, onStateChange, value]); + return (