Skip to content

Commit

Permalink
Removing posts to display should be instant.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Jul 25, 2017
1 parent 813af21 commit 3d9b34a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion blocks/library/latest-posts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ registerBlockType( 'core/latest-posts', {

changePostsToShow( postsToShow ) {
const { setAttributes } = this.props;

setAttributes( { postsToShow: parseInt( postsToShow, 10 ) || 0 } );
}

Expand All @@ -110,6 +109,12 @@ registerBlockType( 'core/latest-posts', {
);
}

// Removing posts from display should be instant.
const postsDifference = latestPosts.length - this.props.attributes.postsToShow;
if ( postsDifference > 0 ) {
latestPosts.splice( this.props.attributes.postsToShow, postsDifference );
}

const { focus } = this.props;
const { displayPostDate, align, layout } = this.props.attributes;
const layoutControls = [
Expand Down

0 comments on commit 3d9b34a

Please sign in to comment.