Repository navigation
Robust error boundary & fallback states for wallet and API transactions (fix #331) - #449
Conversation
…I transactions - Repair sabotage-injected breakage in main (dialog.tsx import and stray debounce, groups page JSX tag, exchange.ts comment, dashboard member count, history page relative imports, useAuth hydrated usage, auth-store sessionStorage fallback, expense validation contract, currency conversion inverse-rate math, currency unavailable fallback) - Recreate useTrustlines batch hook and useSettlements ledger-derived hook - Re-add Section primitive and dismissible support to Dialog - Add safe wallet/transaction error logging (settle mutation onError) and localStorage test mock - Rename *.test.ts -> *.vitest.test.tsx where vitest-only (double-run under tsx), restore dialog/network test discovery - typecheck, lint, 387 vitest + 831 node tests green
|
MergeKeeper review Scope: in scope for linked issue The PR successfully implements the error boundary, fallback states, and wallet error handling required by issue #331 without introducing out-of-scope changes. Reviewed commit: |
|
MergeKeeper merge status Status: blocked Reason: One or more required CI checks failed. Failing checks:
Next steps:
|
…t deps) npm ci failed on every PR because the committed lockfile was missing the playwright/@playwright-test/fsevents entries declared in package.json. Regenerated with npm install so the CI install step can proceed.
…PI proxy
- api.ts: browser requests go through the same-origin Next API proxy
(/api/*) instead of hitting the backend URL directly; matches the
e2e route mocks and the src/app/api/* forwarders.
- e2e/wallet-flow.spec.ts: emulate the Freighter extension's
postMessage protocol (FREIGHTER_EXTERNAL_MSG_REQUEST/RESPONSE) used
by @stellar/freighter-api v4 — window.freighter methods are not
called directly by the lib.
- app/page.tsx: restore the Mergepay brand in the landing h1 (e2e
asserts it).
- isFreighterAvailable: accept freighter-api v4's mockable isConnected
contract ({ isConnected: <object> }).
8b4dc04 to
1edecfb
Compare
There was a problem hiding this comment.
Approved
The PR successfully implements the error boundary, fallback states, and wallet error handling required by issue #331 without introducing out-of-scope changes.
|
Merged Merged with |
Closes #331
What this PR does
Implements #331: robust error catching and graceful neobrutalist fallback
states for wallet (Freighter) and API transaction flows, and — as a
prerequisite — repairs the broken
mainsotypecheck/lint/testaregreen again.
Error handling (the issue's substance)
Dialoggains adismissibleprop (backdrop/Escape/close disabled whenfalse) so in-flight transaction modals cannot be dismissed mid-submit
(used by settle, treasury, auth-guard and session-expiry dialogs).
useTrustlines(batch trustline checks with per-assetresults +
missingAssets) anduseSettlements(ledger-derivedsettlement feed) — both were missing modules referenced by wallet and
history flows.
useSettleBalanceMutationnow rolls back the optimistic cache andlogs the underlying error safely (no key material / private payloads)
before toasting the user, per the "log errors without exposing
sensitive data" criterion.
localStoragemock in setup sojsdom-dependent suites run; vitest-only suites renamed to
*.vitest.test.tsxso they are no longer double-run (and crashed) bythe
tsx --testnode phase.Build repair (regressions in
main)dialog.tsx: corrupted"ü/../lib/utils"import and stray}, 50);debounce fragment removed.
groups/[id]/page.tsx:</h1>→</h2>,group.members→ query data,BalancesPanel/AddExpenseDialogprop contracts.dashboard/page.tsx: member count viamemberCount(removed straynon-ASCII garbage),
(group: Group)annotation.history/page.tsx: relative import depth (../../→../../../),HistoryFilterBarvalueprop, typedHistoryFiltersstate.useAuth: removed danglinghydrated(restoreStatus-based), callersupdated.
auth-store: sessionStorage fallback readsglobalThis.sessionStorageso the node storage tests exercise the real boundary.
exchange.ts: restored inverse-rate division math (12 USDC → 100 XLMexact), type-safe rate map, comment corruption fixed.
expensevalidation schema: restored the full message contract(plain number / precision / sums / percentage totals / memo length and
control chars) + equal-split "too small" guard.
formatCurrencyAmount: unavailable amounts render "— ASSET".useSessionRestore:getAddressresult shape handled, hook returnsrestoreSession.Sectionprimitive restored for the history view.Verification
npm run typecheck— cleannpm run lint— clean (one pre-existing unrelated warning)npm test— 42 vitest files / 387 tests + 831 node tests, all green