Skip to content

Commit

Permalink
fixed update control array data in Constructor (can't clear)
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-o committed Apr 18, 2020
1 parent c8cb79e commit 2ab1db6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/assets/admin/constructor/store/block-data/reducer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@ function reducer( state = { data: false }, action ) {
state.data.controls &&
state.data.controls[ action.id ]
) {
// We can't just use merge() here, as it will merge inner arrays
// but we always need to override it.
return {
...state,
data: merge(
{},
state.data,
{
controls: {
[ action.id ]: action.data,
data: {
...( state.data || {} ),
controls: {
...( state.data.controls || {} ),
[ action.id ]: {
...( state.data.controls[ action.id ] || {} ),
...action.data,
},
}
),
},
},
};
}

Expand Down

0 comments on commit 2ab1db6

Please sign in to comment.