Skip to content

Commit

Permalink
Merge pull request #1507 from tomusborne/fix/query-posts-per-page
Browse files Browse the repository at this point in the history
Fix: Query posts_per_page when set to -1
  • Loading branch information
tomusborne authored Nov 19, 2024
2 parents af57692 + ffdd81f commit c22f526
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/blocks/looper/components/LoopInnerBlocksRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,11 @@ export function LoopInnerBlocksRenderer( props ) {

const loopItemsContext = useMemo( () => {
if ( hasResolvedData && Array.isArray( data ) ) {
let perPage = query?.posts_per_page ?? 10;
let perPage = query?.posts_per_page
? query?.posts_per_page
: 10;

if ( -1 === perPage ) {
if ( '-1' === perPage?.toString() ) {
perPage = data.length;
}

Expand Down

0 comments on commit c22f526

Please sign in to comment.