Skip to content

fix(orders): filter before cursor pagination and preserve selected order state - #1162

Merged
khaira777 merged 10 commits into
mainfrom
codex/orders-filtered-pagination
Oct 15, 2026
Merged

khaira777 merged 10 commits into
mainfrom
codex/orders-filtered-pagination

Conversation

@khaira777

@khaira777 khaira777 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Implement the approved issue #1146 Orders release fix: support the optional all, active, and unpaid API views with existing caller defaults, apply server-side view and table/type/status/search filters before stable numeric cursor pagination at 15 matching orders per page, preserve the all-orders visibility invariant, and use positive check-level payable balances for unpaid results. Update the Orders UI to reset page state on filter changes, reject stale requests, refresh live results safely, keep the selected detail visible with truthful list/missing notices, preserve mobile navigation, make the detail panel fill its pane, and place Load more in the master list or card layout. Update canonical API documentation and keep meaningful API/UI regressions. Also fix the reproduced live-pagination race: when Load more reintroduces the selected order after a new match displaced page one, apply the appended snapshot, clear the notice, and invalidate delayed detail responses; an appended page omitting the selection alone must not mark it outside the list. Preserve current-main finance/status and cancellation PIN safeguards, including the !cancelRequiresPin control, and all role/action guards. Keep changes minimal, retain the reviewed local Load More renderer and every pipeline commit, do not add style abstractions, use the same open PR #1162, revalidate fully, and leave it unmerged.

What Changed

  • Added server-side view parameter filtering (all, active, and unpaid) to GET /api/orders and applied table, type, status, and search filters before cursor-based pagination.
  • Updated the Orders dashboard to paginate 15 orders per page from the backend, reject stale in-flight requests on filter changes, and preserve selected order details with status notices when displaced from the active list.
  • Embedded the Load More action within the master list and card layouts, ensured the detail panel fills its container, and added comprehensive API and master-detail regression test coverage.

Risk Assessment

✅ Low: The changes cleanly implement filtered cursor pagination and master-detail selection preservation with sound race-condition handling and comprehensive regression coverage.

Testing

Exercised backend API filtered pagination and live frontend UI scenarios in Chromium against running servers, validating 15-item pagination, filter reset and race guards, detail pane preservation with notices, pagination race recovery via Load More, and mobile navigation, with 6 reviewer-visible screenshots captured.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Orders API applies views (all, active, unpaid), table, type, status, and search filters before cursor pagination at 15 items/page, and restricts unpaid view to positive payable balances ✅ pass live npm run test:orders-search
Orders split view renders master list with inline Load More button and full-width detail pane, loading next 15 orders on demand without dropping selected order ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/01-orders-split-layout-load-more.png
Orders UI resets pagination cursor on filter/search change and rejects out-of-order older search responses ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/02-orders-search-filter-active.png
Selected order detail remains visible when external updates remove it from current list, showing 'This order is no longer in the current list.' banner ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/03-order-not-in-current-list-notice.png
Load more restores a displaced selected order, applies the appended snapshot, clears the warning notice, and invalidates delayed detail responses ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/04-orders-load-more-restored-selection.png
Mobile viewport collapses split layout into list-first flow, transitioning to full-width detail pane with a working Back button ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/05-orders-mobile-detail-with-back.png

01-orders-split-layout-load-more.png

Evidence: 01-orders-split-layout-load-more.png
Screenshot demonstrating desktop master/detail split view with order selected and Load more button rendered inside the master pane footer.
![02-orders-search-filter-active.png](https://github.com/user-attachments/assets/e8e3c99c-7b3d-4527-8f08-7809d3588678)
Evidence: 02-orders-search-filter-active.png
Screenshot demonstrating filtered search view with pagination reset.
![03-order-not-in-current-list-notice.png](https://github.com/user-attachments/assets/f7c81009-0ff2-44bb-adaf-98070c5919e0)
Evidence: 03-order-not-in-current-list-notice.png
Screenshot demonstrating detail pane preserving selected order when externally cancelled, showing the banner: 'This order is no longer in the current list.'
![04-orders-load-more-restored-selection.png](https://github.com/user-attachments/assets/f9e1a9ce-b593-42ff-b7a4-332be8604578)
Evidence: 04-orders-load-more-restored-selection.png
Screenshot demonstrating Load more reintroducing displaced order, restoring latest status and clearing the warning banner.
![05-orders-mobile-detail-with-back.png](https://github.com/user-attachments/assets/39532a9f-3313-4a58-b017-1432346d13c0)
Evidence: 05-orders-mobile-detail-with-back.png
Screenshot demonstrating mobile viewport detail view with top Back button.
![06-orders-mobile-master-list-returned.png](https://github.com/user-attachments/assets/f2aadd95-8d98-440d-b43b-8d99bf3f1531)
Evidence: 06-orders-mobile-master-list-returned.png
Screenshot demonstrating return to master list upon tapping Back on mobile.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Orders API applies views (all, active, unpaid), table, type, status, and search filters before cursor pagination at 15 items/page, and restricts unpaid view to positive payable balances ✅ pass live npm run test:orders-search
Orders split view renders master list with inline Load More button and full-width detail pane, loading next 15 orders on demand without dropping selected order ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/01-orders-split-layout-load-more.png
Orders UI resets pagination cursor on filter/search change and rejects out-of-order older search responses ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/02-orders-search-filter-active.png
Selected order detail remains visible when external updates remove it from current list, showing 'This order is no longer in the current list.' banner ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/03-order-not-in-current-list-notice.png
Load more restores a displaced selected order, applies the appended snapshot, clears the warning notice, and invalidates delayed detail responses ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/04-orders-load-more-restored-selection.png
Mobile viewport collapses split layout into list-first flow, transitioning to full-width detail pane with a working Back button ✅ pass live ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8/05-orders-mobile-detail-with-back.png
  • npm run test:orders-search
  • cd frontend && npx playwright test --config=playwright.config.ts --project=chromium e2e/orders-master-detail.spec.ts
  • Live product validation in Chromium with visual evidence generation (6 screenshots) in ~/.no-mistakes/evidence/01M5036NRJ0K8XWPNK9ETCJRJ8
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7080dae8-b572-4dd3-a8c7-607881434905

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous selection-recovery issue fixed and no new actionable findings.

Summary

The PR moves Orders filters before server-side pagination and keeps selected details visible through live list changes.

  • Order pages now match the chosen view and filters before they paginate.
  • The Orders screen loads 15 matching orders at a time.
  • Selected order details stay open and current as the list changes.

Review used source inspection and a clean git diff --check. Builds, tests, and browser checks were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Choose filters] --> B[Reset list and selection]
  B --> C[Request 15 matching orders]
  C --> D[Server filters before cursor and limit]
  D --> E{Response still current?}
  E -->|No| F[Ignore response]
  E -->|Yes| G[Update list]
  G --> H{Page contains selected order?}
  H -->|Yes| I[Update detail and clear notice]
  H -->|No, full refresh| J[Keep detail and check order separately]
Loading

Reviews (2) · Last reviewed commit: "fix(orders): sync current main into revi..." · Reviewed by Greptile

Comment thread frontend/src/app/(dashboard)/orders/page.tsx Outdated
@khaira777 khaira777 changed the title fix(orders): filter before pagination and preserve detail selection fix(orders): filter before cursor pagination and preserve selected order state Oct 15, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

@greptile review

@khaira777
khaira777 merged commit 7c9900d into main Oct 15, 2026
23 checks passed
@khaira777
khaira777 deleted the codex/orders-filtered-pagination branch October 15, 2026 16: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.

1 participant