EDM-3868: Reset page to 1 when filters change - #664
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. WalkthroughRefactors device filtering and pagination. Adds filter-change pagination resets, exposes a stable backend filter key, simplifies ChangesDevice Pagination and Filter Management
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The PR makes a localized pagination behavior change for filtered device and catalog views, and no actionable merge-blocking risk remains in the supplied evidence. Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@libs/ui-components/src/components/Device/DevicesPage/useDeviceBackendFilters.ts`:
- Around line 19-26: getSearchParamsQueryKey currently builds a joined string
from searchParams.entries() that can collide when keys/values contain '&' or
'='; update getSearchParamsQueryKey to percent-encode each entry before joining
(e.g., encodeURIComponent on both key and value) or use URLSearchParams
serialization that performs encoding, keep the .map/.sort/.join logic intact but
replace `${key}=${value}` with an encoded pair so filterKey is unambiguous
(refer to function name getSearchParamsQueryKey).
In `@libs/ui-components/src/components/Device/DevicesPage/useDevices.ts`:
- Around line 174-188: useDevicesPaginated now fetches all enrolled devices and
drops the fleetless filter used by the install wizard; restore a fleetless-only
filter by passing a filter flag into useDevicesEndpoint (or include it in the
textFilters) when called from useDevicesPaginated so the API request limits to
fleetless devices. Locate useDevicesPaginated and the useDevicesEndpoint call
and add the fleetless filter (e.g., include a property like fleetless: true or
FilterSearchParams.Fleetless) to the options passed to useDevicesEndpoint (while
preserving existing textFilters and nextContinue) so downstream components (like
SpecificationsStep) can still get only fleetless devices. Ensure you reference
FilterSearchParams.NameOrAlias and keep pagination.nextContinue unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 969d5b83-8095-414f-bcde-68c3194b6c26
📒 Files selected for processing (6)
libs/ui-components/src/components/Catalog/InstallWizard/steps/SelectTargetStep.tsxlibs/ui-components/src/components/Catalog/InstallWizard/steps/SpecificationsStep.tsxlibs/ui-components/src/components/Device/DevicesPage/DevicesPage.tsxlibs/ui-components/src/components/Device/DevicesPage/useDeviceBackendFilters.tslibs/ui-components/src/components/Device/DevicesPage/useDevices.tslibs/ui-components/src/hooks/useTablePagination.ts
5238d87 to
4d82bf9
Compare
Made-with: Cursor
4d82bf9 to
58370a2
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Fixes filters not returning the expected results when the user was on a page other than page 1.
Fixed for:
useDevicesPaginatedto make the code simpler while keeping all existing functionality)Summary by CodeRabbit
Bug Fixes
Shared UI Components
useResetPaginationOnFilterChangefor reusable pagination state handling.useDevicesPaginatedto accept device name and package-mode filters.Cross-Cutting Impact
libs/ui-components/.libs/types/,libs/i18n/,libs/cypress/, platform-specific app code, the Go auth proxy, container builds, E2E tests, or CI configuration.