Skip to content

Fix bug when current page is empty string#4241

Merged
johngodley merged 2 commits into
trunkfrom
fix/paginate-empty
Jul 4, 2026
Merged

Fix bug when current page is empty string#4241
johngodley merged 2 commits into
trunkfrom
fix/paginate-empty

Conversation

@johngodley

Copy link
Copy Markdown
Owner

If you change the current page to an empty string the API request is NaN and the page is cleared.

Copilot AI review requested due to automatic review settings July 4, 2026 05:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes pagination/state handling so clearing the current-page input doesn’t produce a NaN page request and inadvertently clear table data, by keeping prior query data during refetches and tightening loading/complete status derivation.

Changes:

  • Keep previous TanStack Query results during parameter changes via placeholderData in list queries.
  • Adjust page-level loading/complete status logic to avoid showing “loading” when placeholder (previous) data exists.
  • Make pagination input store a string and commit/clamp the page number on blur to avoid NaN propagation.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/page/redirects/index.tsx Updates loading/complete status logic to account for placeholder (previous) data.
src/page/logs404/index.tsx Updates loading status logic to avoid loading state when placeholder data exists.
src/page/logs/index.tsx Updates loading/complete status logic to account for placeholder (previous) data.
src/page/groups/index.tsx Updates loading status logic to avoid loading state when placeholder data exists.
src/lib/api/hooks/use-redirect-list.ts Keeps previous query data during refetch; adds user-facing error reporting.
src/lib/api/hooks/use-logs.ts Keeps previous query data during refetch for logs and 404s.
src/lib/api/hooks/use-group-list.ts Keeps previous query data during refetch; adds user-facing error reporting.
src/component/table/navigation/pagination-links.tsx Prevents empty page input from producing NaN by committing a validated page number on blur.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/component/table/navigation/pagination-links.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@johngodley johngodley merged commit 6a2e074 into trunk Jul 4, 2026
9 checks passed
@johngodley johngodley deleted the fix/paginate-empty branch July 4, 2026 06:04
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.

2 participants