@@ -406,7 +406,7 @@ function EditingTypeChangeSourceLayerSource(props: {
406406 )
407407 const [ schemaValues , setSchemaValues ] = React . useState ( {
408408 type : selectedSourceGroup ,
409- value :
409+ values :
410410 props . pendingChanges . find ( ( change ) => change . operationId === props . userEditOperation . id ) ?. value ||
411411 props . userEditOperation . currentValues . value ,
412412 } )
@@ -422,7 +422,7 @@ function EditingTypeChangeSourceLayerSource(props: {
422422 const handleSourceChange = ( ) => {
423423 setSchemaValues ( {
424424 type : selectedSourceGroup ,
425- value : schemaValues . value ,
425+ values : schemaValues . values ,
426426 } )
427427 // Add to pending changes instead of executing immediately
428428 props . setPendingChanges ( ( prev ) => {
@@ -433,13 +433,20 @@ function EditingTypeChangeSourceLayerSource(props: {
433433 change . userEditingType === UserEditingType . SOURCE_LAYER_FORM
434434 )
435435 )
436+ // Only use the key,value pair from the selected source group:
437+ const newKey = Object . keys ( schemaValues . values ) . find ( ( key ) => {
438+ return props . userEditOperation . schemas [ key ] . sourceLayerType === selectedSourceGroup
439+ } )
440+ if ( ! newKey ) return filtered
441+ const newValue = props . userEditOperation . currentValues . value [ newKey ]
442+
436443 return [
437444 ...filtered ,
438445 {
439446 operationId : props . userEditOperation . id ,
440447 userEditingType : UserEditingType . SOURCE_LAYER_FORM ,
441448 sourceLayerType : selectedSourceGroup ,
442- values : schemaValues . value ,
449+ value : { [ newKey ] : newValue } ,
443450 } ,
444451 ]
445452 } )
@@ -472,7 +479,7 @@ function EditingTypeChangeSourceLayerSource(props: {
472479 < a className = "propertiespanel-pop-up__label" > { t ( 'Source' ) } :</ a >
473480 < SchemaFormInPlace
474481 schema = { schema }
475- object = { schemaValues . value }
482+ object = { schemaValues . values }
476483 translationNamespaces = { props . userEditOperation . translationNamespaces }
477484 />
478485 < br />
0 commit comments