Skip to content

Conversation

@jacksonplus
Copy link

πŸ”— Linked issue

resolves #353

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The page change handler prefetches page.value + 1 on each navigation, but it
does not check whether this next page exceeds maxPage. This causes the app to
fetch non-existent pages (e.g. page 11 when only 10 pages exist), resulting in
unnecessary network requests without any benefit.

This PR updates the logic to:

  • Use the target page (to + 1) as the prefetch target instead of page.value + 1.
  • Only prefetch when to + 1 <= maxPage.
  • Ensure displayedPage is always updated, even on the last page.

This avoids invalid requests, improves runtime efficiency, and preserves the
intended UX behavior.

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

Successfully merging this pull request may close these issues.

Prefetch requests exceed maxPage in pageChanged

1 participant