@@ -10,8 +10,8 @@ import {
10
10
11
11
import { useAtom } from 'jotai'
12
12
import { isEqual , omit } from 'lodash-es'
13
- import { useMemo , useState } from 'react'
14
- import { UseFieldArrayRemove , UseFormSetError } from 'react-hook-form'
13
+ import { FC , useMemo , useState } from 'react'
14
+ import { UseFieldArrayRemove } from 'react-hook-form'
15
15
16
16
import { AppToaster } from 'components/Toaster'
17
17
import { CopilotDocV1 } from 'models/copilot.schema'
@@ -106,10 +106,7 @@ const SheetGroup = ({
106
106
}
107
107
const checkSamePinned = ( target : string ) =>
108
108
! ! favGroups . find ( ( { name } ) => name === target )
109
- const changeOperatorOfOtherGroups = (
110
- target : Operator [ ] | undefined ,
111
- errHandle : UseFormSetError < Group > ,
112
- ) => {
109
+ const changeOperatorOfOtherGroups = ( target : Operator [ ] | undefined ) => {
113
110
target ?. forEach ( ( item ) => {
114
111
existedGroups . forEach ( ( groupItem ) => {
115
112
const oldLength = groupItem . opers ?. length || 0
@@ -118,7 +115,7 @@ const SheetGroup = ({
118
115
( operItem ) => operItem . name !== item . name ,
119
116
)
120
117
if ( groupItem . opers ?. length !== oldLength )
121
- submitGroup ( groupItem , errHandle , true )
118
+ submitGroup ( groupItem , undefined , true )
122
119
}
123
120
} )
124
121
} )
@@ -129,12 +126,7 @@ const SheetGroup = ({
129
126
{ ...value } ,
130
127
] )
131
128
132
- const eventHandleProxy = (
133
- type : EventType ,
134
- value : Group ,
135
- setError ?: UseFormSetError < Group > ,
136
- ) => {
137
- const errHandle = setError || function ( ) { }
129
+ const eventHandleProxy = ( type : EventType , value : Group ) => {
138
130
switch ( type ) {
139
131
case 'add' : {
140
132
if ( checkGroupExisted ( value . name ) ) {
@@ -143,9 +135,8 @@ const SheetGroup = ({
143
135
intent : Intent . DANGER ,
144
136
} )
145
137
} else {
146
- if ( checkGroupPinned ( value ) )
147
- changeOperatorOfOtherGroups ( value . opers , errHandle )
148
- submitGroup ( value , errHandle )
138
+ if ( checkGroupPinned ( value ) ) changeOperatorOfOtherGroups ( value . opers )
139
+ submitGroup ( value )
149
140
}
150
141
break
151
142
}
@@ -163,16 +154,16 @@ const SheetGroup = ({
163
154
break
164
155
}
165
156
case 'rename' : {
166
- submitGroup ( value , errHandle , true )
157
+ submitGroup ( value , undefined , true )
167
158
break
168
159
}
169
160
case 'opers' : {
170
- changeOperatorOfOtherGroups ( value . opers , errHandle )
171
- submitGroup ( value , errHandle , true )
161
+ changeOperatorOfOtherGroups ( value . opers )
162
+ submitGroup ( value , undefined , true )
172
163
break
173
164
}
174
165
case 'update' : {
175
- submitGroup ( value , errHandle , true )
166
+ submitGroup ( value , undefined , true )
176
167
break
177
168
}
178
169
}
@@ -291,11 +282,7 @@ const SheetGroup = ({
291
282
const EditorGroupName = ( {
292
283
eventHandleProxy,
293
284
} : {
294
- eventHandleProxy : (
295
- type : EventType ,
296
- value : Group ,
297
- setError ?: UseFormSetError < Group > | undefined ,
298
- ) => void
285
+ eventHandleProxy : ( type : EventType , value : Group ) => void
299
286
} ) => {
300
287
const [ groupName , setGroupName ] = useState ( '' )
301
288
@@ -346,7 +333,7 @@ const EditorGroupName = ({
346
333
)
347
334
}
348
335
349
- export const SheetGroupContainer = ( sheetGroupProps : SheetGroupProps ) => (
336
+ export const SheetGroupContainer : FC < SheetGroupProps > = ( sheetGroupProps ) => (
350
337
< SheetContainerSkeleton title = "设置干员组" icon = "people" >
351
338
< SheetGroup { ...sheetGroupProps } />
352
339
</ SheetContainerSkeleton >
0 commit comments