Skip to content

404 request before last page check with prefill #690

@einkoro

Description

@einkoro

When you use the prefill option it will 404 trying to grab a page that doesn't exist before the last check fires. I encountered this working with WordPress & WooCommerce but have created a minimal test case linked below.

[InfiniteScroll] pageIndex. current page determined to be: 1 from next link
[InfiniteScroll] initialized. on products
[InfiniteScroll] prefill
[InfiniteScroll] request. URL: /shop/page/2/
XHR finished loading: GET "https://shopmmcurate.com.dev/shop/page/2/".
[InfiniteScroll] scrollThreshold
[InfiniteScroll] load. Products – Page 2 – Shop MMCurate. URL: /shop/page/2/
[InfiniteScroll] append. 2 items. URL: /shop/page/2/
[InfiniteScroll] prefill
[InfiniteScroll] request. URL: /shop/page/3/
[InfiniteScroll] last. URL: /shop/page/2/
GET https://shopmmcurate.com.dev/shop/page/3/ 404 ()
[InfiniteScroll] error. Error. URL: /shop/page/3/
XHR failed loading: GET "https://shopmmcurate.com.dev/shop/page/3/".
$( '.archive .products' ).infiniteScroll( {
    path: '.page-numbers .next',
    append: '.product',
    prefill: true,
    debug: true
} );

Test case: http://mmcurate.com/test/test-case.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions