@@ -55,19 +55,25 @@ const CommonSettings = () => {
55
55
)
56
56
localStorage . setItem ( 'configuration' , JSON . stringify ( updatedConfiguration ) )
57
57
setConfiguration ( updatedConfiguration )
58
+ setRows ( ( prevRows : any ) =>
59
+ prevRows . map ( ( row : any ) =>
60
+ row . id === updatedRow . id ? { ...updatedRow } : row
61
+ )
62
+ )
58
63
}
59
64
60
65
const getUpdatedConfiguration = (
61
66
updatedRow : any ,
62
67
rowIndex : number ,
63
68
currentConfiguration : Configuration
64
69
) : Configuration => {
70
+ const newConfiguration = { ...currentConfiguration }
65
71
const fieldName = toSnakeCase ( updatedRow . fieldName )
66
- if ( ! currentConfiguration . demographicFields ) {
72
+ if ( ! newConfiguration . demographicFields ) {
67
73
return currentConfiguration
68
74
}
69
75
70
- const fieldToUpdate = currentConfiguration . demographicFields [ rowIndex ]
76
+ const fieldToUpdate = { ... newConfiguration . demographicFields [ rowIndex ] }
71
77
72
78
if ( ! fieldToUpdate ) {
73
79
return currentConfiguration
@@ -76,7 +82,10 @@ const CommonSettings = () => {
76
82
fieldToUpdate . fieldName = fieldName
77
83
78
84
if ( updatedRow ?. indexGoldenRecord ) {
79
- fieldToUpdate . indexGoldenRecord = `@index(${ updatedRow . indexGoldenRecord . replace ( ' ' , '' ) } )`
85
+ fieldToUpdate . indexGoldenRecord = `@index(${ updatedRow . indexGoldenRecord . replace (
86
+ ' ' ,
87
+ ''
88
+ ) } )`
80
89
}
81
90
82
91
if ( updatedRow ?. m ) {
@@ -93,9 +102,9 @@ const CommonSettings = () => {
93
102
} as LinkMetaData
94
103
}
95
104
96
- currentConfiguration . demographicFields [ rowIndex ] = fieldToUpdate
105
+ newConfiguration . demographicFields [ rowIndex ] = fieldToUpdate
97
106
98
- return currentConfiguration
107
+ return newConfiguration
99
108
}
100
109
101
110
const handleCancelClick = ( id : GridRowId ) => ( ) => {
0 commit comments