We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f6609d commit 876e8cfCopy full SHA for 876e8cf
packages/core-data/src/selectors.ts
@@ -642,7 +642,7 @@ export const getEntityRecordsTotalPages = (
642
if ( ! queriedState ) {
643
return null;
644
}
645
- if ( query.per_page === -1 ) {
+ if ( query?.per_page === -1 ) {
646
return 1;
647
648
const totalItems = getQueriedTotalItems( queriedState, query );
@@ -651,7 +651,7 @@ export const getEntityRecordsTotalPages = (
651
652
// If `per_page` is not set and the query relies on the defaults of the
653
// REST endpoint, get the info from query's meta.
654
- if ( ! query.per_page ) {
+ if ( ! query?.per_page ) {
655
return getQueriedTotalPages( queriedState, query );
656
657
return Math.ceil( totalItems / query.per_page );
0 commit comments