File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/components/ConfigureImageClassification Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ export default ({ iface, onChange }) => {
3232 ( ) => ( {
3333 multiple : iface . multiple ? iface . multiple : false ,
3434 labels :
35- ( iface . labels || [ ] ) . map ( ( a ) =>
36- typeof a === "string" ? { id : a , description : a } : a
37- ) || [ ] ,
35+ ( iface . labels || [ ] ) . map ( ( a ) => {
36+ return typeof a === "string" ? { id : a , description : a } : a
37+ } ) || [ ] ,
3838 } ) ,
3939 [ iface . labels , iface . multiple ]
4040 )
@@ -43,7 +43,14 @@ export default ({ iface, onChange }) => {
4343 noActions
4444 variant = "flat"
4545 defaultAnswers = { defaultAnswers }
46- onQuestionChange = { ( questionId , newValue , answers ) => {
46+ onQuestionChange = { ( questionId , newValue ) => {
47+ var arrayId = [ ]
48+ if ( Array . isArray ( newValue ) )
49+ newValue = newValue . filter ( ( json ) => {
50+ if ( arrayId . includes ( json . id ) ) return false
51+ arrayId . push ( json . id )
52+ return true
53+ } )
4754 onChange ( setIn ( iface , [ questionId ] , newValue ) )
4855 } }
4956 form = { form }
You can’t perform that action at this time.
0 commit comments