Skip to content

Commit

Permalink
fix: logic for load more button in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Oct 19, 2020
1 parent 36d024e commit b92cd2d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/blocks/curated-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,7 @@ const CuratedListEditorComponent = ( {
const posts = await response.json();

setAttributes( { queriedListings: posts } );

if ( nextUrl && showLoadMore ) {
setHasMorePages( true );
} else {
setHasMorePages( false );
}
setHasMorePages( !! nextUrl );

if ( 0 === posts.length ) {
throw 'No posts matching query options. Try selecting different or less specific query options.';
Expand Down Expand Up @@ -451,7 +446,7 @@ const CuratedListEditorComponent = ( {
) }
{ // If in query mode, show the queried listings.
! isFetching && queryMode && queriedListings.map( renderQueriedListings ) }
{ ! isFetching && queryMode && hasMorePages && (
{ ! isFetching && queryMode && showLoadMore && hasMorePages && (
<Button className="newspack-listings__load-more" isPrimary>
{ loadMoreText }
</Button>
Expand Down

0 comments on commit b92cd2d

Please sign in to comment.