@@ -180,7 +180,7 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) {
180
180
control,
181
181
handleSubmit,
182
182
setError,
183
- formState : { errors, isDirty , isSubmitting } ,
183
+ formState : { errors, isSubmitting } ,
184
184
} = useForm < FormValues > ( {
185
185
defaultValues : operationSet || {
186
186
name : '' ,
@@ -220,7 +220,7 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) {
220
220
< div className = "grow" >
221
221
< OperationSelector
222
222
operationSet = { operationSet }
223
- ref = { operationSelectorRef }
223
+ selectorRef = { operationSelectorRef }
224
224
/>
225
225
</ div >
226
226
</ >
@@ -302,7 +302,7 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) {
302
302
) }
303
303
304
304
< Button
305
- disabled = { ! isDirty || isSubmitting }
305
+ disabled = { isSubmitting }
306
306
intent = "primary"
307
307
loading = { isSubmitting }
308
308
type = "submit"
@@ -326,14 +326,17 @@ interface OperationSelectorProps {
326
326
operationSet : OperationSet
327
327
328
328
// 这个组件做成受控组件的话,输入输出比较难处理,所以做成非受控组件,用 ref 获取值
329
- ref : Ref < OperationSelectorRef >
329
+ selectorRef : Ref < OperationSelectorRef >
330
330
}
331
331
332
332
interface OperationSelectorRef {
333
333
getValues ( ) : { idsToAdd : number [ ] ; idsToRemove : number [ ] }
334
334
}
335
335
336
- function OperationSelector ( { operationSet, ref } : OperationSelectorProps ) {
336
+ function OperationSelector ( {
337
+ operationSet,
338
+ selectorRef,
339
+ } : OperationSelectorProps ) {
337
340
const { operations, error } = useOperations ( {
338
341
operationIds : operationSet . copilotIds ,
339
342
} )
@@ -348,7 +351,7 @@ function OperationSelector({ operationSet, ref }: OperationSelectorProps) {
348
351
)
349
352
350
353
useImperativeHandle (
351
- ref ,
354
+ selectorRef ,
352
355
( ) => ( {
353
356
getValues ( ) {
354
357
const idsToAdd : number [ ] = [ ]
0 commit comments