@@ -26,6 +26,7 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
2626 const flowTypeStore = useStore ( FlowTypeService )
2727 const flowService = useService ( FlowService )
2828 const validation = useFlowValidation ( instance . id )
29+ const changedValue = React . useRef ( false )
2930 const [ , startTransition ] = React . useTransition ( )
3031
3132 const definition = React . useMemo (
@@ -43,7 +44,7 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
4344 }
4445 } )
4546 return values
46- } , [ definition , instance ] )
47+ } , [ definition ] )
4748
4849 const flowNode = useNodes ( ) . find ( value => value . id == instance . id )
4950
@@ -64,7 +65,7 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
6465 }
6566 } )
6667 return values
67- } , [ instance , validation ] )
68+ } , [ validation , instance , definition ] )
6869
6970 const onSubmit = React . useCallback ( ( values : Record < string , LiteralValue | undefined > ) => {
7071 startTransition ( async ( ) => {
@@ -74,11 +75,12 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
7475 if ( typeof index !== "number" ) return
7576
7677 const value = values [ flowTypeSetting . id ! ]
77-
7878 await flowService . setSettingValue ( props . instance . id , index , value ?. value , flowTypeSetting . identifier )
79+
80+ changedValue . current = false
7981 }
8082 } )
81- } , [ definition ] )
83+ } , [ flowService , definition ] )
8284
8385 const [ inputs , validate , values ] = useForm < Record < string , LiteralValue | undefined > > ( {
8486 initialValues : initialValues ,
@@ -89,8 +91,16 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
8991 } )
9092
9193 React . useEffect (
92- ( ) => validate ( ) ,
93- [ validation ?. length , values ]
94+ ( ) => {
95+ if ( changedValue . current )
96+ validate ( )
97+ } ,
98+ [ values ]
99+ )
100+
101+ React . useEffect (
102+ ( ) => validate ( undefined , false ) ,
103+ [ validation ]
94104 )
95105
96106 return < >
@@ -122,6 +132,7 @@ export const FunctionFileTriggerComponent: React.FC<FunctionFileTriggerComponent
122132 schema = { ( flowNode ?. data ?. schema as NodeSchema [ ] ) ?. [ index ] }
123133 description = { description }
124134 clearable
135+ onChange = { ( ) => changedValue . current = true }
125136 { ...inputs . getInputProps ( settingDefinition . id ! ) }
126137 />
127138 < Spacing spacing = { "xl" } />
0 commit comments