diff --git a/.eslintrc.js b/.eslintrc.js index 7951d8b23a47f8..11234eb7de9f56 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -80,6 +80,7 @@ module.exports = { name: 'lodash', importNames: [ 'differenceWith', + 'dropRight', 'findIndex', 'isUndefined', 'memoize', diff --git a/packages/block-library/src/columns/edit.js b/packages/block-library/src/columns/edit.js index 432fc4d3204455..3216bb4b83969a 100644 --- a/packages/block-library/src/columns/edit.js +++ b/packages/block-library/src/columns/edit.js @@ -2,7 +2,7 @@ * External dependencies */ import classnames from 'classnames'; -import { dropRight, get, times } from 'lodash'; +import { get, times } from 'lodash'; /** * WordPress dependencies @@ -199,9 +199,9 @@ const ColumnsEditContainerWrapper = withDispatch( ]; } else { // The removed column will be the last of the inner blocks. - innerBlocks = dropRight( - innerBlocks, - previousColumns - newColumns + innerBlocks = innerBlocks.slice( + 0, + -( previousColumns - newColumns ) ); if ( hasExplicitWidths ) { diff --git a/packages/block-library/src/columns/edit.native.js b/packages/block-library/src/columns/edit.native.js index 66904b57772450..d2fbf2123db582 100644 --- a/packages/block-library/src/columns/edit.native.js +++ b/packages/block-library/src/columns/edit.native.js @@ -2,7 +2,7 @@ * External dependencies */ import { View, Dimensions } from 'react-native'; -import { dropRight, times, map, compact, delay } from 'lodash'; +import { times, map, compact, delay } from 'lodash'; /** * WordPress dependencies */ @@ -394,9 +394,9 @@ const ColumnsEditContainerWrapper = withDispatch( ]; } else { // The removed column will be the last of the inner blocks. - innerBlocks = dropRight( - innerBlocks, - previousColumns - newColumns + innerBlocks = innerBlocks.slice( + 0, + -( previousColumns - newColumns ) ); if ( hasExplicitWidths ) {