Repository navigation
fix(orders): fetch bill on filtered tab print - #1650
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoFix receipt printing for orders outside the active tab
AI Description
Merge Risk
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab) |
|
@greptile review |
[Low impact] The PR appears safe to merge; no actionable issues were found.
|
Intent
Fix the confirmed non-product bug tracked in #1639 where
OrdersPage.handlePrintprematurely fails with"Bill not found"when printing an order that has left the currently filtered Orders tab instead of fetchingGET /api/bills/:id. Ship a minimal fix with regression tests via a PR that closes#1639.What Changed
candidateOrders/matchedBillguard inOrdersPage.handlePrint(frontend/src/app/(dashboard)/orders/page.tsx) so printing always fetchesGET /api/bills/:ideven when the order is no longer in the active filtered tab.404responses and empty payloads fromGET /api/bills/:id(when nofallbackBillis provided) by showing thebillNotFoundtoast and returning early instead of throwing, while preserving non-404 error propagation.tests/orders-search.test.tscovering out-of-tab bill printing,404and null-bill responses, and non-404 fetch errors with and without an in-tab cached bill.Closes
#1639Risk Assessment
✅ Low: Minimal, well-bounded fix in OrdersPage.handlePrint that removes the premature local-tab guard, surfaces billNotFound on 404 or missing bill payloads without falling back to cached list bills, and adds regression tests covering out-of-tab printing and error handling.
Testing
Built the backend and desktop frontend, ran
npm run test:orders-search(all unit, API, and performance tests passed including the newhandlePrintregression test), and drove three live Chromium scenarios against the real isolated FloCafe server (tests/e2e-server.cjs) covering out-of-tab receipt printing, 404 bill-not-found handling, and in-tab 500 error handling without stale fallback, capturing four PNG screenshots as evidence; all scenarios passed.Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
frontend/src/app/(dashboard)/orders/page.tsx:1513- UnrequiredmatchedBillfallback introduced inhandlePrint(also atfrontend/src/app/(dashboard)/orders/page.tsx:1497andfrontend/src/app/(dashboard)/orders/page.tsx:1507). No requirement in the user intent asks to fall back to the cached bill from the localorderslist—the intent is specifically to fetchGET /api/bills/:idwhen an order has left the filtered tab (wherematchedBillisundefinedanyway). This fallback also introduces a regression for orders still in the current tab whenoptions?.fallbackBillis not passed: previously, a non-404GET /bills/:idfailure (e.g., 500, 403, 401, or network error) threw and surfacedorders.printReceiptFailed, whereas nowhandlePrintsilently swallows the error and prints potentially stalematchedBilldata from the list snapshot (and similarly printsmatchedBillifGET /bills/:idreturns 200 with a missingbillpayload). Smallest honest remedy: removematchedBillat line 1497 and its fallback uses at lines 1507 and 1513, keeping onlyoptions?.fallbackBill.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run buildnpm run build:frontendnpm run test:orders-searchPlaywright Chromium live E2E verification against tests/e2e-server.cjs (scenarios 1-3 on /orders Unpaid tab with cards layout)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Issues
Closes #1639