Skip to content

Commit 876e8cf

Browse files
Mamadukaramonjd
andauthored
Core Data: Fix error in 'getEntityRecordsTotalPages' selector (#71303)
Co-authored-by: Mamaduka <[email protected]> Co-authored-by: ramonjd <[email protected]>
1 parent 1f6609d commit 876e8cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core-data/src/selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ export const getEntityRecordsTotalPages = (
642642
if ( ! queriedState ) {
643643
return null;
644644
}
645-
if ( query.per_page === -1 ) {
645+
if ( query?.per_page === -1 ) {
646646
return 1;
647647
}
648648
const totalItems = getQueriedTotalItems( queriedState, query );
@@ -651,7 +651,7 @@ export const getEntityRecordsTotalPages = (
651651
}
652652
// If `per_page` is not set and the query relies on the defaults of the
653653
// REST endpoint, get the info from query's meta.
654-
if ( ! query.per_page ) {
654+
if ( ! query?.per_page ) {
655655
return getQueriedTotalPages( queriedState, query );
656656
}
657657
return Math.ceil( totalItems / query.per_page );

0 commit comments

Comments
 (0)