Skip to content

fix(pos): improve payment error feedback - #612

Merged
ignaciosantise merged 3 commits into
mainfrom
fix/friendly-pos-error-messages
Sep 2, 2026
Merged

fix(pos): improve payment error feedback#612
ignaciosantise merged 3 commits into
mainfrom
fix/friendly-pos-error-messages

Conversation

@ignaciosantise

Copy link
Copy Markdown
Collaborator

Summary

  • show a retryable Activity error state when the initial payment load fails
  • keep loaded payments visible and use a friendly toast for refresh failures
  • prevent technical settings and printer errors from reaching merchants
  • bump Android versionCode to 4

Validation

  • git diff --check
  • Not run: app dependencies are not installed in this workspace (jest, expo, prettier, and TypeScript are unavailable).

Copilot AI lite review requested due to automatic review settings September 2, 2026 18:30
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pos-demo Ready Ready Preview Sep 2, 2026 6:57pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
react-native-appkit Ignored Ignored Preview Sep 2, 2026 6:57pm UTC
react-native-walletkit Ignored Ignored Preview Sep 2, 2026 6:57pm UTC

Request Review

@claude

claude Bot commented Sep 2, 2026

Copy link
Copy Markdown

Claude finished @ignaciosantise's task in 1m 53s —— View job


Code Review

  • Gather context
  • Read changed files
  • Analyze diff
  • Post findings

Found 1 issue(s)

Issue 1: Toast may fire repeatedly on successive React Query retries

ID: activity-toast-retry-dedupe-a3f1
File: dapps/pos-app/app/activity.tsx:113
Severity: LOW
Category: code_quality

Context:

  • Pattern: The useEffect dep array includes error (the Error object from useTransactions). React Query may produce a new error object reference on each automatic retry, even when the error message is identical.
  • Risk: Each retry that fails creates a fresh Error reference → useEffect fires → another toast appears, stacking multiple toasts while the list is still visible.
  • Trigger: isError=true, isEmpty=false, and React Query retries are enabled (the default). Under poor connectivity the user can see 3+ stacked toasts.

Recommendation: Gate the toast on a stable derived value so it fires at most once per error event:

// Use error.message (primitive) instead of the error object to avoid
// firing on new-reference-but-same-message retries.
useEffect(() => {
  if (isError && error?.message && !isEmpty) {
    showErrorToast(
      "We couldn't refresh payments. Check your internet connection and try again.",
    );
  }
}, [isError, error?.message, isEmpty]);

The rest of the changes are well-structured:

  • isEmpty correctly moved before the useEffect that depends on it.
  • isError EmptyState branch correctly sits after isLoading and before filter checks, so the "Try again" CTA only appears on initial-load failures (not refresh failures with visible data).
  • renderEmptyComponent deps array correctly updated to include isError and refetch.
  • Printer error path in settings.tsx correctly drops the raw error string fallback — error || "message" would have shown internal strings to merchants when error was a truthy non-Error value.
  • use-merchant-flow.ts catch now logs the raw message while showing only the friendly copy to the merchant.

Comment thread dapps/pos-app/app/activity.tsx

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new Activity error-state logic uses an “empty list” heuristic that can misclassify refresh failures (especially when the last successful result was empty) and the CTA passes an async refetch where a sync handler is expected.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refines merchant-facing error handling in the POS app by replacing technical error strings with friendlier messaging, and by improving Activity screen behavior when payments fail to load or refresh. It also increments the Android versionCode for the next release.

Changes:

  • Replace settings/printer error toasts with merchant-friendly, non-technical messages.
  • Update Activity screen to show a retryable empty-state on initial load failure and a lighter refresh-failure toast when data is already present.
  • Bump Android versionCode from 3 → 4.
File summaries
File Description
dapps/pos-app/hooks/use-merchant-flow.ts Replaces technical save failure messaging with a user-friendly toast while keeping detailed logs.
dapps/pos-app/app/settings.tsx Ensures printer connection failures show a consistent merchant-friendly toast rather than raw errors.
dapps/pos-app/app/activity.tsx Adds initial-load error empty state and refresh-failure toast behavior for payments fetching.
dapps/pos-app/app.json Increments Android versionCode for release progression.
Review details

Suppressed comments (1)

dapps/pos-app/app/activity.tsx:190

  • The empty/error UI currently triggers on any isError, which will also replace the normal empty states after a refetch failure when the last successful result was an empty list. Consider only showing the retryable error state when the initial load failed (i.e. no cached data). Also, EmptyState's CTA onPress is typed as () => void, so passing refetch (async) directly will fail TypeScript checks—wrap it and ignore the returned promise.
        <EmptyState
          title="We couldn't load payments"
          subtitle="Check your internet connection and try again."
          cta={{ label: "Try again", onPress: refetch }}
        />
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dapps/pos-app/app/activity.tsx
@ignaciosantise
ignaciosantise merged commit a72036c into main Sep 2, 2026
9 checks passed
@ignaciosantise
ignaciosantise deleted the fix/friendly-pos-error-messages branch September 2, 2026 19:12
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.

2 participants