From e0556490510aeb3bf81fd010a8ecfe194e675dfc Mon Sep 17 00:00:00 2001 From: Derrick Koo Date: Fri, 16 Jul 2021 11:17:42 -0600 Subject: [PATCH 1/3] feat: bump max number of items per list from 20 to 50 --- src/components/sidebar-query-controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/sidebar-query-controls.js b/src/components/sidebar-query-controls.js index 9f1239ed..602fb6b4 100644 --- a/src/components/sidebar-query-controls.js +++ b/src/components/sidebar-query-controls.js @@ -243,7 +243,7 @@ class QueryControls extends Component { setAttributes( { queryOptions: { ...queryOptions, maxItems: value } } ) } min={ 1 } - max={ 20 } + max={ 50 } required />, Date: Mon, 19 Jul 2021 11:59:36 +0200 Subject: [PATCH 2/3] fix(curated-list-block): maxItems param handling --- src/blocks/curated-list/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blocks/curated-list/edit.js b/src/blocks/curated-list/edit.js index f2f069ae..6101ee70 100644 --- a/src/blocks/curated-list/edit.js +++ b/src/blocks/curated-list/edit.js @@ -116,7 +116,7 @@ const CuratedListEditorComponent = ( { setError( null ); const posts = await apiFetch( { path: addQueryArgs( '/newspack-listings/v1/listings', { - query: { ...query, maxItems: MAX_EDITOR_ITEMS }, // Get up to MAX_EDITOR_ITEMS listings in the editor so we can show all locations. + query: { maxItems: MAX_EDITOR_ITEMS, ...query }, // Get up to MAX_EDITOR_ITEMS listings in the editor so we can show all locations. _fields: 'id,title,author,category,tags,excerpt,media,meta,type,sponsors', } ), } ); From be18b1b19358312f0624987e9122f2dbfc9d3146 Mon Sep 17 00:00:00 2001 From: Derrick Koo Date: Mon, 19 Jul 2021 11:22:10 -0600 Subject: [PATCH 3/3] chore: remove unneeded maxItems check --- src/blocks/curated-list/edit.js | 35 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/blocks/curated-list/edit.js b/src/blocks/curated-list/edit.js index 6101ee70..162e516e 100644 --- a/src/blocks/curated-list/edit.js +++ b/src/blocks/curated-list/edit.js @@ -307,27 +307,20 @@ const CuratedListEditorComponent = ( { * @param {Object} listing Post object for listing to show. * @param {number} index Index of the item in the array. */ - const renderQueriedListings = ( listing, index ) => { - // Only display up to the maxItems setting. - if ( index >= queryOptions.maxItems ) { - return null; - } - - return ( -
- - { - - } -
- ); - }; + const renderQueriedListings = ( listing, index ) => ( +
+ + { + + } +
+ ); /** * Validate location data.