Fix bug when current page is empty string#4241
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
placeholderDatain 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
NaNpropagation.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you change the current page to an empty string the API request is NaN and the page is cleared.