@@ -151,16 +151,19 @@ export const UpdateConfig: React.FC<{
151151 function ( r : any , name : any ) {
152152 return (
153153 ( r [ name ] =
154- flavor ?. configSchema ?. properties [ name ] . type === 'string' &&
155- flavor ?. configSchema ?. properties [ name ] . default === undefined
154+ flavor ?. configSchema ?. properties [ name ] ? .type === 'string' &&
155+ flavor ?. configSchema ?. properties [ name ] ? .default === undefined
156156 ? ''
157- : flavor ?. configSchema ?. properties [ name ] . default ) ,
157+ : flavor ?. configSchema ?. properties [ name ] ?. type === 'array' &&
158+ ! flavor ?. configSchema ?. properties [ name ] ?. default ?. length
159+ ? [ '' ]
160+ : flavor ?. configSchema ?. properties [ name ] ?. default ) ,
158161 r
159162 ) ;
160163 } ,
161164 { } ,
162165 ) ;
163-
166+ console . log ( result , 'asdasdasd23232' ) ;
164167 const mappedObject = {
165168 ...result ,
166169 ...stackComponent ?. configuration ,
@@ -209,41 +212,45 @@ export const UpdateConfig: React.FC<{
209212 let tempFinal : any = { } ;
210213
211214 Object . keys ( inputFields ) . forEach ( ( key ) => {
212- const newObj : any = { } ;
213- inputFields [ key ] . forEach ( ( obj : any ) => {
214- if ( obj . key !== undefined && ( obj . key !== '' || obj . value !== '' ) ) {
215- if ( newObj [ obj . key ] !== undefined ) {
216- dispatch (
217- showToasterAction ( {
218- description : 'Key already exists.' ,
219- type : toasterTypes . failure ,
220- } ) ,
221- ) ;
222- } else {
223- newObj [ obj . key ] = obj . value ;
215+ if ( flavor ?. configSchema ?. properties [ key ] . type !== 'array' ) {
216+ const newObj : any = { } ;
217+ inputFields [ key ] . forEach ( ( obj : any ) => {
218+ if ( obj . key !== undefined && ( obj . key !== '' || obj . value !== '' ) ) {
219+ if ( newObj [ obj . key ] !== undefined ) {
220+ dispatch (
221+ showToasterAction ( {
222+ description : 'Key already exists.' ,
223+ type : toasterTypes . failure ,
224+ } ) ,
225+ ) ;
226+ } else {
227+ newObj [ obj . key ] = obj . value ;
228+ }
224229 }
225- }
226- } ) ;
227- tempFinal [ key ] = newObj ;
230+ } ) ;
231+ tempFinal [ key ] = newObj ;
232+ }
228233 } ) ;
229234 const final : any = { } ;
230235
231236 Object . keys ( inputFields ) . forEach ( ( key ) => {
232- const newObj : any = { } ;
233- inputFields [ key ] . forEach ( ( obj : any ) => {
234- if ( obj . key !== undefined && ( obj . key !== '' || obj . value !== '' ) ) {
235- if ( newObj [ obj . key ] !== undefined ) {
236- dispatch (
237- showToasterAction ( {
238- description : 'Key already exists.' ,
239- type : toasterTypes . failure ,
240- } ) ,
241- ) ;
237+ if ( flavor ?. configSchema ?. properties [ key ] . type !== 'array' ) {
238+ const newObj : any = { } ;
239+ inputFields [ key ] . forEach ( ( obj : any ) => {
240+ if ( obj . key !== undefined && ( obj . key !== '' || obj . value !== '' ) ) {
241+ if ( newObj [ obj . key ] !== undefined ) {
242+ dispatch (
243+ showToasterAction ( {
244+ description : 'Key already exists.' ,
245+ type : toasterTypes . failure ,
246+ } ) ,
247+ ) ;
248+ }
249+ newObj [ obj . key ] = obj . value ;
242250 }
243- newObj [ obj . key ] = obj . value ;
244- }
245- } ) ;
246- final [ key ] = newObj ;
251+ } ) ;
252+ final [ key ] = newObj ;
253+ }
247254 } ) ;
248255
249256 const body = {
0 commit comments