Skip to content

Collection Pagination throwing error: No route matches URL /api/countries #3149

@adrianxadamn

Description

@adrianxadamn

What is the location of your example repository?

Can create demo store with @shopify/hydrogen@latest

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

Latest

What version of Remix are you using?

Latest

Steps to Reproduce

If your URL contains pagination params and try to load the next set of products, sometimes the page throws this error We’ve lost this Error: No route matches URL "/api/countries" It takes a few hard page refresh and clicking the load more products button to see this error, but when it happens, it breaks the page. For Shopify's demo store, it redirects to a 404 page.

  1. visit: https://hydrogen.shop/collections/freestyle?direction=next&cursor=eyJsYXN0X2lkIjo2NzMwOTQzOTIyMjMyLCJsYXN0X3ZhbHVlIjoiMDlsbGxsayIsIm9mZnNldCI6N30%3D
  2. Scroll down until the load more products CTA is visible which triggers a request to get the next set of products. Keep retrying until you see the error. It's easier to replicate if you make a hard fresh and immediately click on the CTAs to load more products or scroll down to load more products which produces the error more frequently. See loom video below

https://www.loom.com/share/a793caae4ae8492a873dd58ce5eee074

Expected Behavior

Not sure why getting the next set of products throws this error. It shouldn't. Not sure why this happen if using the <Pagination /> component

Actual Behavior

Sometimes paginating products on hard refresh and then immediately clicking to load more products throws an no route error which could break the page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions