From b92cd2d4aeecd9b385883e20d663e893da304ee3 Mon Sep 17 00:00:00 2001 From: Derrick Koo Date: Mon, 19 Oct 2020 11:06:06 -0600 Subject: [PATCH] fix: logic for load more button in editor --- src/blocks/curated-list/edit.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/blocks/curated-list/edit.js b/src/blocks/curated-list/edit.js index 458f20cb..cda7b526 100644 --- a/src/blocks/curated-list/edit.js +++ b/src/blocks/curated-list/edit.js @@ -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.'; @@ -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 && (