Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination not consistent on refresh of page #2323

Closed
jnhamid opened this issue Jul 11, 2024 · 1 comment
Closed

Pagination not consistent on refresh of page #2323

jnhamid opened this issue Jul 11, 2024 · 1 comment

Comments

@jnhamid
Copy link

jnhamid commented Jul 11, 2024

What is the location of your example repository?

private

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2024.4.7

What version of Remix are you using?

2.9.2

Steps to Reproduce

I followed the steps here to create a paginated product display.
Pagination Example
I followed the steps here and got a working example of the Pagination, but If I get a page of results and then refresh the page only the most recent page is shown and not any of the previous pages.

Expected Behavior

I would expect on refresh that you query for everything from the previous pages until you get to the cursor.

Actual Behavior

Only the single page of results are shown if the page is refreshed.

@blittle
Copy link
Contributor

blittle commented Jul 12, 2024

This is expected behavior. Pagination works by storing the pages inside history pushState. It's available on refresh, but if it renders synchronously, it will produce a hydration error, because the server is only rendering a single page. At the same time it needs to render synchronously to properly restore the scroll position when the user navigates to a specific product, and then clicks the back button. It's a known shortcoming, but we agreed to be a reasonable tradeoff, because most users don't refresh a list, but they do expect scroll to restore on back and forth navigation.

@blittle blittle closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants