Skip to content

Commit

Permalink
change updateSelection param where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Oct 22, 2020
1 parent 8dcfd25 commit c41cd62
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ function BlockVariationPicker( { isVisible, onClose, clientId, variations } ) {
const onVariationSelect = ( variation ) => {
replaceInnerBlocks(
clientId,
createBlocksFromInnerBlocksTemplate( variation.innerBlocks ),
false
createBlocksFromInnerBlocksTemplate( variation.innerBlocks )
);
onClose();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function useBlockSync( {
if ( clientId ) {
setHasControlledInnerBlocks( clientId, true );
__unstableMarkNextChangeAsNotPersistent();
replaceInnerBlocks( clientId, controlledBlocks, false );
replaceInnerBlocks( clientId, controlledBlocks );
} else {
resetBlocks( controlledBlocks );
}
Expand Down
8 changes: 4 additions & 4 deletions packages/block-editor/src/store/test/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,17 +1100,17 @@ describe( 'actions', () => {
blocks: [ block ],
rootClientId: 'root',
time: expect.any( Number ),
updateSelection: true,
updateSelection: false,
} );
} );

it( 'should return the REPLACE_INNER_BLOCKS action with updateSelection false', () => {
expect( replaceInnerBlocks( 'root', [ block ], false ) ).toEqual( {
it( 'should return the REPLACE_INNER_BLOCKS action with updateSelection true', () => {
expect( replaceInnerBlocks( 'root', [ block ], true ) ).toEqual( {
type: 'REPLACE_INNER_BLOCKS',
blocks: [ block ],
rootClientId: 'root',
time: expect.any( Number ),
updateSelection: false,
updateSelection: true,
} );
} );
} );
Expand Down
5 changes: 3 additions & 2 deletions packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const ColumnsEditContainerWrapper = withDispatch(
}
}

replaceInnerBlocks( clientId, innerBlocks, false );
replaceInnerBlocks( clientId, innerBlocks );
},
} )
)( ColumnsEditContainer );
Expand Down Expand Up @@ -235,7 +235,8 @@ function Placeholder( { clientId, name, setAttributes } ) {
clientId,
createBlocksFromInnerBlocksTemplate(
nextVariation.innerBlocks
)
),
true
);
}
} }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/columns/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const ColumnsEditContainerWrapper = withDispatch(
);
}

replaceInnerBlocks( clientId, innerBlocks, false );
replaceInnerBlocks( clientId, innerBlocks );
},
onAddNextColumn: () => {
const { clientId } = ownProps;
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/navigation/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ export default compose( [
}
dispatch( 'core/block-editor' ).replaceInnerBlocks(
clientId,
blocks
blocks,
true
);
},
};
Expand Down

0 comments on commit c41cd62

Please sign in to comment.