fix(frontend): stop devices date filter from resetting pagination - #2953
Conversation
Rolling date presets rebuilt ISO bounds on every reload, so the query signature changed on each Next click and pinned the table on page 1. Use a stable mode-based signature, skip recount on page-only navigation, and apply date-range payload before refresh. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
📝 WalkthroughWalkthroughThe PR adds shared table date-range utilities, stabilizes device-table reload state, and changes deployment and log tables to load older pages without resetting existing results. ChangesTable date-range pagination
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DatePicker
participant DeviceTable
participant dateRange
DatePicker->>DeviceTable: Apply date range
DeviceTable->>dateRange: Create stable range signature
DeviceTable->>dateRange: Decide recount behavior
DeviceTable->>DeviceTable: Refresh bounds and pagination state
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
LogTable and DeploymentTable treated TableLog reload as a full reset, so Load older always snapped back to page 1. Append the previous window instead and share the time-window helper with unit coverage. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Merging this PR will not alter performance
Comparing Footnotes
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_8ba37d17-9ea1-45a7-afa2-509ebd043949) |
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Keep the applied rolling window fixed for cursor pagination so Next reuses cursors against the same updated_at bounds. Snap the window only on Apply, Reset, or toolbar Reload. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_999cde2a-e513-4b22-b782-968537dd8184) |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/components/tables/LogTable.vue`:
- Around line 185-186: Update the range checks in getTimeWindowPageRange callers
so rangeStart and rangeEnd are compared explicitly against undefined rather than
tested for truthiness, preserving valid epoch timestamp 0. Apply this in
src/components/tables/LogTable.vue lines 185-186 and
src/components/tables/DeploymentTable.vue lines 50-51.
🪄 Autofix
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: ASSERTIVE
Plan: Pro
Run ID: 97ad6ebe-4829-41ba-bbf8-9bafba4476e9
📒 Files selected for processing (5)
src/components/tables/DeploymentTable.vuesrc/components/tables/DeviceTable.vuesrc/components/tables/LogTable.vuesrc/services/dateRange.tstests/date-range-query.unit.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Extract a shared DeviceTable pagination reset helper so reload paths stay consistent, and treat epoch 0 as a valid logs time-window bound. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_be13f24c-997b-4a2c-b9d6-1c692d0bab20) |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/date-range-query.unit.test.ts (1)
55-59: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winMake the wall-clock test deterministic.
The test does not change the system time, so it does not prove stability across clock changes. Use
vi.useFakeTimers()and two distinctvi.setSystemTime()values. Keep the test non-concurrent and restore real timers withvi.useRealTimers().🤖 Prompt for 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. In `@tests/date-range-query.unit.test.ts` around lines 55 - 59, Update the test “keeps rolling table signatures stable across wall-clock ticks” to run non-concurrently with vi.useFakeTimers(), capture signatures at two distinct vi.setSystemTime() values, and compare them for stability. Restore real timers with vi.useRealTimers() after the test.Source: Learnings
🤖 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.
Outside diff comments:
In `@tests/date-range-query.unit.test.ts`:
- Around line 55-59: Update the test “keeps rolling table signatures stable
across wall-clock ticks” to run non-concurrently with vi.useFakeTimers(),
capture signatures at two distinct vi.setSystemTime() values, and compare them
for stability. Restore real timers with vi.useRealTimers() after the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8ccd4688-cf25-47ae-8fb1-c0b80cc417c3
📒 Files selected for processing (4)
src/components/tables/DeploymentTable.vuesrc/components/tables/DeviceTable.vuesrc/components/tables/LogTable.vuetests/date-range-query.unit.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
|



Summary (AI generated)
now-based ISO timestampsMotivation (AI generated)
A Brazil customer with ~213k devices after an App ID migration reported that Devices page date filters and pagination did not work. Root cause: every page change rebuilt rolling
updated_at_gt/updated_at_ltefromnew Date(), changed the query signature, and resetcurrentPageto 1. Checking logs found the same failure mode:reload()forced page 1 on every Load older click. PR #2931 fixed dashboard UTC chart days only and did not cover these table paths.Business Impact (AI generated)
Customers with large device fleets can page and filter Devices, and browse older logs/deployments again, reducing support noise after App ID migrations and large MAU apps.
Test Plan (AI generated)
bunx vitest run tests/date-range-query.unit.test.tsbunx eslinton touched filesGenerated with AI
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit