File tree Expand file tree Collapse file tree 4 files changed +5
-6
lines changed
src/blocks/remote-data-container Expand file tree Collapse file tree 4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -288,9 +288,8 @@ private static function generate_http_query_config_schema(): array {
288
288
'pagination_schema ' => Types::nullable (
289
289
Types::object ( [
290
290
// This field provides an integer representing the total number of
291
- // items available in paginated results. This field must be defined
292
- // in order present to enable pagination support of any type,
293
- // including cursor-based pagination.
291
+ // items available in paginated results. Either this field or
292
+ // `has_next_page` must be defined in order to enable
294
293
'total_items ' => Types::nullable (
295
294
Types::object ( [
296
295
'name ' => Types::nullable ( Types::string () ),
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ export function ItemList( props: ItemListProps ) {
162
162
onChangeView = { onChangeView }
163
163
paginationInfo = { {
164
164
totalItems : totalItems ?? data . length ,
165
- totalPages : totalPages ?? ( hasNextPage ? page + 1 : page - 1 ) ,
165
+ totalPages : totalPages ?? ( hasNextPage ? page + 1 : page - 1 ) ?? 1 ,
166
166
} }
167
167
search = { supportsSearch }
168
168
view = { view }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export function usePaginationVariables( {
36
36
initialPerPage,
37
37
inputVariables,
38
38
} : UsePaginationVariablesInput ) : UsePaginationVariables {
39
- const [ paginationData , setPaginationData ] = useState < RemoteDataPagination > ( { } ) ;
39
+ const [ paginationData , setPaginationData ] = useState < RemoteDataPagination > ( ) ;
40
40
const [ page , setPage ] = useState < number > ( initialPage ) ;
41
41
const [ perPage , setPerPage ] = useState < number | null > ( initialPerPage ?? null ) ;
42
42
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ interface InnerBlockContext {
3
3
}
4
4
5
5
interface RemoteDataPagination {
6
- hasNextPage ?: boolean ;
7
6
cursorNext ?: string ;
8
7
cursorPrevious ?: string ;
8
+ hasNextPage ?: boolean ;
9
9
totalItems ?: number ;
10
10
}
11
11
You can’t perform that action at this time.
0 commit comments