Skip to content

fix(pos): preserve payment queue pagination and RTL controls - #1416

Merged
khaira777 merged 1 commit into
mainfrom
codex/audit-payment-queue
Oct 31, 2026
Merged

khaira777 merged 1 commit into
mainfrom
codex/audit-payment-queue

Conversation

@khaira777

Copy link
Copy Markdown
Contributor

Summary

Addresses release audit finding F-4 for payment queue presentation and layout:

  • Fixes payment queue drawer pagination handling so loaded pages and scroll positions are preserved across automated refreshes.
  • Ensures RTL directional mirroring for arrows, drawers, and control alignment across POS drawers and settings tabs.
  • Adds missing translation keys across all 24 supported locales in frontend/src/locales/*.json.

Changes

  • PaymentQueueDrawer.tsx: Retain pagination and loaded pages during periodic queue refreshes; apply RTL directional classes to chevron icons and drawers.
  • CountersSettingsTab.tsx & QrMenuSettingsTab.tsx: Fix RTL layout alignment for controls and toggles.
  • frontend/src/locales/*.json: Complete locale translations for all 24 languages.

Stack

Verification

  • npm run i18n:check: Passed (all 24 locales)
  • npm run test:i18n-ssr-timezone: Passed (all 24 locales)
  • npm run test:rtl-foundation: Passed
  • Playwright payment queue refresh test (e2e/multi-counter-ordering.spec.ts:1435): Passed

@coderabbitai

coderabbitai Bot commented Oct 31, 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

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

fix(pos): preserve payment queue pagination and RTL controls

🐞 Bug fix ✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Rewrites payment queue drawer fetching so loaded pages survive the 5s auto-refresh. Polling pauses
 after "Load more", with a localized notice.
• Adds request sequencing and de-duplication to prevent stale responses and duplicate tickets.
• Switches drawer search and settings table controls to logical RTL classes, and formats the QR menu
 date with the locale-aware hook.
• Adds a paymentQueueRefreshPaused message to all 24 locale files and a Playwright test for the
 refresh behavior.
Diagram

graph TD
  Poll["5s Poll Timer"] --> Fetch["fetchQueue"] --> API["awaiting-payment API"] --> State["Orders State"] --> UI["PaymentQueueDrawer"]
  LoadMore["Load More"] --> Pause["Pause Polling"] --> Fetch
  Refresh["Manual Refresh"] --> Fetch
  Pause --> Poll
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Data-fetching library with infinite query (e.g. React Query)
  • ➕ Built-in refetching of all loaded pages
  • ➕ Less hand-rolled ref logic
  • ➖ New dependency or refactor
  • ➖ Larger scope for an audit fix
2. Poll the first page only and merge it into the loaded list
  • ➕ Fresh data keeps arriving while the user is paginating
  • ➖ Ordering and removal handling are complex
  • ➖ Can shift the scroll position

Recommendation: The PR's approach is acceptable: it stops polling after pagination and shows a notice, with a manual refresh to resume. A cursor-merge or data-fetching library could avoid pausing polling, but that is a larger change.

Files changed (28) +223 / -104

Enhancement (26) +52 / -24
CountersSettingsTab.tsxRTL-aware counters table alignment +25/-23

RTL-aware counters table alignment

• Replaces text-left/right with text-start/end and wraps the action buttons in an inline-flex gap container instead of using space-x.

frontend/src/components/settings/CountersSettingsTab.tsx

QrMenuSettingsTab.tsxUse locale-aware date formatting +3/-1

Use locale-aware date formatting

• Replaces toLocaleString with the useFormatDate formatDateTime hook for the QR menu updated_at timestamp.

frontend/src/components/settings/QrMenuSettingsTab.tsx

en.jsonAdd paymentQueueRefreshPaused string (en) +1/-0

Add paymentQueueRefreshPaused string (en)

• Adds the pos.paymentQueueRefreshPaused message.

frontend/src/lib/i18n/messages/en.json

ar.jsonAdd paymentQueueRefreshPaused string (ar) +1/-0

Add paymentQueueRefreshPaused string (ar)

• Adds the Arabic translation.

frontend/src/lib/i18n/messages/ar.json

bn.jsonAdd paymentQueueRefreshPaused string (bn) +1/-0

Add paymentQueueRefreshPaused string (bn)

• Adds the Bengali translation.

frontend/src/lib/i18n/messages/bn.json

de.jsonAdd paymentQueueRefreshPaused string (de) +1/-0

Add paymentQueueRefreshPaused string (de)

• Adds the German translation.

frontend/src/lib/i18n/messages/de.json

es.jsonAdd paymentQueueRefreshPaused string (es) +1/-0

Add paymentQueueRefreshPaused string (es)

• Adds the Spanish translation.

frontend/src/lib/i18n/messages/es.json

fa.jsonAdd paymentQueueRefreshPaused string (fa) +1/-0

Add paymentQueueRefreshPaused string (fa)

• Adds the Persian translation.

frontend/src/lib/i18n/messages/fa.json

fil.jsonAdd paymentQueueRefreshPaused string (fil) +1/-0

Add paymentQueueRefreshPaused string (fil)

• Adds the Filipino translation.

frontend/src/lib/i18n/messages/fil.json

fr.jsonAdd paymentQueueRefreshPaused string (fr) +1/-0

Add paymentQueueRefreshPaused string (fr)

• Adds the French translation.

frontend/src/lib/i18n/messages/fr.json

hi.jsonAdd paymentQueueRefreshPaused string (hi) +1/-0

Add paymentQueueRefreshPaused string (hi)

• Adds the Hindi translation.

frontend/src/lib/i18n/messages/hi.json

id.jsonAdd paymentQueueRefreshPaused string (id) +1/-0

Add paymentQueueRefreshPaused string (id)

• Adds the Indonesian translation.

frontend/src/lib/i18n/messages/id.json

it.jsonAdd paymentQueueRefreshPaused string (it) +1/-0

Add paymentQueueRefreshPaused string (it)

• Adds the Italian translation.

frontend/src/lib/i18n/messages/it.json

ja.jsonAdd paymentQueueRefreshPaused string (ja) +1/-0

Add paymentQueueRefreshPaused string (ja)

• Adds the Japanese translation.

frontend/src/lib/i18n/messages/ja.json

ko.jsonAdd paymentQueueRefreshPaused string (ko) +1/-0

Add paymentQueueRefreshPaused string (ko)

• Adds the Korean translation.

frontend/src/lib/i18n/messages/ko.json

ne.jsonAdd paymentQueueRefreshPaused string (ne) +1/-0

Add paymentQueueRefreshPaused string (ne)

• Adds the Nepali translation.

frontend/src/lib/i18n/messages/ne.json

nl.jsonAdd paymentQueueRefreshPaused string (nl) +1/-0

Add paymentQueueRefreshPaused string (nl)

• Adds the Dutch translation.

frontend/src/lib/i18n/messages/nl.json

pt.jsonAdd paymentQueueRefreshPaused string (pt) +1/-0

Add paymentQueueRefreshPaused string (pt)

• Adds the Portuguese translation.

frontend/src/lib/i18n/messages/pt.json

ru.jsonAdd paymentQueueRefreshPaused string (ru) +1/-0

Add paymentQueueRefreshPaused string (ru)

• Adds the Russian translation.

frontend/src/lib/i18n/messages/ru.json

sq.jsonAdd paymentQueueRefreshPaused string (sq) +1/-0

Add paymentQueueRefreshPaused string (sq)

• Adds the Albanian translation.

frontend/src/lib/i18n/messages/sq.json

th.jsonAdd paymentQueueRefreshPaused string (th) +1/-0

Add paymentQueueRefreshPaused string (th)

• Adds the Thai translation.

frontend/src/lib/i18n/messages/th.json

tr.jsonAdd paymentQueueRefreshPaused string (tr) +1/-0

Add paymentQueueRefreshPaused string (tr)

• Adds the Turkish translation.

frontend/src/lib/i18n/messages/tr.json

ur.jsonAdd paymentQueueRefreshPaused string (ur) +1/-0

Add paymentQueueRefreshPaused string (ur)

• Adds the Urdu translation.

frontend/src/lib/i18n/messages/ur.json

vi.jsonAdd paymentQueueRefreshPaused string (vi) +1/-0

Add paymentQueueRefreshPaused string (vi)

• Adds the Vietnamese translation.

frontend/src/lib/i18n/messages/vi.json

zh-tw.jsonAdd paymentQueueRefreshPaused string (zh-tw) +1/-0

Add paymentQueueRefreshPaused string (zh-tw)

• Adds the Traditional Chinese translation.

frontend/src/lib/i18n/messages/zh-tw.json

zh.jsonAdd paymentQueueRefreshPaused string (zh) +1/-0

Add paymentQueueRefreshPaused string (zh)

• Adds the Simplified Chinese translation.

frontend/src/lib/i18n/messages/zh.json

Bug fix (1) +122 / -80
PaymentQueueDrawer.tsxPreserve loaded pages during queue polling; RTL fixes +122/-80

Preserve loaded pages during queue polling; RTL fixes

• Replaces fetchQueue with a sequence-guarded version that supports append, de-duplication and a poll flag. Polling pauses after Load more and shows a notice. Adds handleRefresh and handleClose, localizes the refresh button label, and uses start/end classes for the search input.

frontend/src/components/pos/PaymentQueueDrawer.tsx

Tests (1) +49 / -0
multi-counter-ordering.spec.tsAdd e2e test for queue refresh keeping loaded pages +49/-0

Add e2e test for queue refresh keeping loaded pages

• Mocks a paginated awaiting-payment API and installs a fake clock. The test loads page 2, advances time past the poll interval, and asserts that ticket 51 is still visible. It restores the multi_counter_enabled setting afterwards.

frontend/e2e/multi-counter-ordering.spec.ts

@qodo-code-review

qodo-code-review Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Paid tickets remain actionable in the queue ✓ Resolved
Description
The refresh-key effect ignores payment completion when pausedRef.current is true, and
handleRetryRelease skips its post-release queue fetch under the same condition. After an operator
loads another page, a completed payment leaves the drawer’s orders, total badge, and pay control
unchanged, while a successful retry leaves the old blocked state and retry control visible.
Code

frontend/src/components/pos/PaymentQueueDrawer.tsx[187]

+    if (open && changed && !pausedRef.current && !searchPendingRef.current) void fetchQueue(null, search);
Relevance

●● Moderate

The paused-pagination interaction is plausible, but no closely matching queue-refresh precedent
establishes team behavior.

PR-#1247
PR-#630

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Loading another page pauses polling. Payment completion then increments paymentQueueRefreshKey,
but the guard drops the drawer refresh, so its badge and pay control continue to render from
unchanged local state. A successful retry release likewise omits its follow-up fetch while paused,
leaving the drawer to render the earlier blocked value after the release request succeeds.

frontend/src/components/pos/PaymentQueueDrawer.tsx[217-224]
frontend/src/components/pos/PaymentQueueDrawer.tsx[184-188]
frontend/src/app/(dashboard)/pos/page.tsx[3079-3092]
frontend/src/components/pos/PaymentQueueDrawer.tsx[503-510]
frontend/src/components/pos/PaymentQueueDrawer.tsx[464-480]
frontend/src/components/pos/PaymentQueueDrawer.tsx[251-256]
frontend/src/components/pos/PaymentQueueDrawer.tsx[382-395]
main/routes/orders.ts[2876-2901]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Payment completion and successful retry releases do not update the open queue drawer after pagination pauses polling, leaving paid orders actionable and released orders shown as blocked.

## Fix Focus Areas
- frontend/src/components/pos/PaymentQueueDrawer.tsx[184-188]
- frontend/src/app/(dashboard)/pos/page.tsx[3079-3092]
- frontend/src/components/pos/PaymentQueueDrawer.tsx[251-256]
- frontend/src/components/pos/PaymentQueueDrawer.tsx[217-224]

## Recommended Fix
Keep periodic first-page replacement paused, but handle payment-completion notifications separately by reconciling the affected order and counts in the loaded list or re-fetching the loaded page range without discarding pagination. After a successful retry release, reconcile the returned order and queue counts with the loaded list, removing orders that are no longer in the queue without replacing loaded pages with only page one.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Reopened queues can appear empty mid-load 🐞 Bug ≡ Correctness
Description
handleSearchChange sets loading to false, while reopening starts fetchQueue without setting it
back to true. If the operator closes the drawer during the search debounce and reopens it with no
retained orders, the active request displays the empty-queue message instead of the loading
indicator.
Code

frontend/src/components/pos/PaymentQueueDrawer.tsx[174]

+    void fetchQueue(null, search);
Relevance

●●● Strong

Reopening during debounce can render an empty state during an active request; loading-state failure
findings are accepted.

PR-#1306

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Search clears loading and close cancels the timer that would restore it. The mounted drawer fetches
on reopening without setting loading, and the renderer interprets false loading plus an empty order
list as an empty queue.

frontend/src/components/pos/PaymentQueueDrawer.tsx[113-127]
frontend/src/components/pos/PaymentQueueDrawer.tsx[171-180]
frontend/src/components/pos/PaymentQueueDrawer.tsx[198-214]
frontend/src/components/pos/PaymentQueueDrawer.tsx[242-248]
frontend/src/components/pos/PaymentQueueDrawer.tsx[566-578]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Closing during a pending search can leave loading false for the next opening request, producing a false empty state.
## Fix Focus Areas
- frontend/src/components/pos/PaymentQueueDrawer.tsx[113-127]
- frontend/src/components/pos/PaymentQueueDrawer.tsx[171-180]
- frontend/src/components/pos/PaymentQueueDrawer.tsx[198-214]
## Recommended Fix
Set loading when starting a cursorless opening or search request, while keeping append requests on the separate loading-more state and guarding stale finalizers.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


3. A failed page load pauses updates ✓ Resolved
Description
handleLoadMore sets pausedRef.current before the append request succeeds, and its failure path
never clears the pause. If that request fails, no older page was loaded, yet periodic and
refresh-key updates remain disabled until the operator retries loading or manually refreshes.
Code

frontend/src/components/pos/PaymentQueueDrawer.tsx[R219-223]

+      appendInFlightRef.current = true;
+      pausedRef.current = true;
+      setPollingPaused(true);
+      setLoading(false);
+      setLoadingMore(true);
Relevance

●●● Strong

Append failures leave polling paused indefinitely, matching accepted reliability fixes for failed
asynchronous loads.

PR-#1306

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The load-more handler pauses before making the request. The catch only logs errors and finalization
clears loading flags, while both automatic update paths check the still-true pause ref.

frontend/src/components/pos/PaymentQueueDrawer.tsx[153-165]
frontend/src/components/pos/PaymentQueueDrawer.tsx[217-224]
frontend/src/components/pos/PaymentQueueDrawer.tsx[184-195]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A failed append request leaves the queue's polling paused even though no older page was added.
## Fix Focus Areas
- frontend/src/components/pos/PaymentQueueDrawer.tsx[218-224]
- frontend/src/components/pos/PaymentQueueDrawer.tsx[153-165]
## Recommended Fix
Track whether an append succeeded; on failure restore the previous pause state and its displayed indicator, while leaving successful loaded-page behavior unchanged.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. The new test never exercises a refresh 🐞 Bug ⚙ Maintainability
Description
The pagination test advances the clock only after clicking Load more, which sets pausedRef.current
and prevents the polling callback from fetching. Its final visibility assertion therefore passes
without an automatic refresh and cannot detect whether a later refresh would discard loaded pages.
Code

frontend/e2e/multi-counter-ordering.spec.ts[R1472-1474]

+    await page.clock.fastForward(11000);
+    await page.clock.runFor(100);
+    await expect(page.getByTestId('queue-ticket-QUEUE-51')).toBeVisible();
Relevance

●●● Strong

The test’s final assertion does not prove polling ran; similar accepted precedents require
meaningful post-event verification.

PR-#1260

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Load more pauses polling; the interval checks the pause flag before fetching. The new test only
advances time and rechecks a previously visible ticket.

frontend/e2e/multi-counter-ordering.spec.ts[1470-1474]
frontend/src/components/pos/PaymentQueueDrawer.tsx[190-195]
frontend/src/components/pos/PaymentQueueDrawer.tsx[217-224]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The pagination test claims to check an automatic refresh, but polling is already paused when it advances the clock.
## Fix Focus Areas
- frontend/e2e/multi-counter-ordering.spec.ts[1470-1474]
- frontend/src/components/pos/PaymentQueueDrawer.tsx[190-195]
## Recommended Fix
Assert that no replacement request occurs while older pages are loaded, then exercise a deliberate refresh or another supported resumption path and verify the expected list and request behavior with route call counts.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Linked PRs:
  🌐 PR #1415
✅ Compliance rules (platform): 5 rules
✅ Cross-repo context — repo relationships
Review mode: Auto: ⚖️ Balanced: Payment queue concurrency and pagination changes carry meaningful behavioral risk.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@khaira777
khaira777 force-pushed the codex/audit-counter-flow branch from cb3a24b to b0ab06b Compare October 31, 2026 21:26
@khaira777
khaira777 force-pushed the codex/audit-payment-queue branch from 8f22404 to d873237 Compare October 31, 2026 21:26
@khaira777
khaira777 force-pushed the codex/audit-counter-flow branch from b0ab06b to b5970ba Compare October 31, 2026 22:55
@khaira777
khaira777 changed the base branch from codex/audit-counter-flow to main October 31, 2026 22:55
@khaira777
khaira777 force-pushed the codex/audit-payment-queue branch from d873237 to c3f5745 Compare October 31, 2026 23:08
@khaira777
khaira777 merged commit b635988 into main Oct 31, 2026
23 checks passed
@khaira777
khaira777 deleted the codex/audit-payment-queue branch October 31, 2026 23:17
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