File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
includes/blocks/mailchimp Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,17 @@ export const BlockEdit = (props) => {
104
104
} ) ,
105
105
) ;
106
106
replaceInnerBlocks ( clientId , [ ...listInnerBlocks ] , false ) ;
107
+
108
+ // Reset groups visibility settings on list change.
109
+ if ( data ?. interest_groups ?. length > 0 ) {
110
+ const newVisibility = data ?. interest_groups ?. reduce ( ( acc , field ) => {
111
+ acc [ field . id ] = 'off' ;
112
+ return acc ;
113
+ } , { } ) ;
114
+ setAttributes ( { interest_groups_visibility : newVisibility } ) ;
115
+ } else {
116
+ setAttributes ( { interest_groups_visibility : { } } ) ;
117
+ }
107
118
} else if ( exisingTags && exisingTags . length > 0 ) {
108
119
// Update existing innerBlocks with if new fields are added to the list or removed from the list.
109
120
const newFormFields = data ?. merge_fields ?. filter (
You can’t perform that action at this time.
0 commit comments