Skip to content

Fix recipient amounts being cleared on locale changes - #1476

Open
danrmiller wants to merge 1 commit into
stagingfrom
fix/recipient-locale-change
Open

danrmiller wants to merge 1 commit into
stagingfrom
fix/recipient-locale-change

Conversation

@danrmiller

@danrmiller danrmiller commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Happens on both mobile and desktop:

  1. Enter a Monero amount such as 1.000000000001.
  2. Change from a period-decimal locale to a comma-decimal locale.
  3. The screen correctly shows 1,000000000001, but the stored amount becomes empty.

Why: changing the displayed text immediately triggers validation. The old parsing code

void _updateRecipientData({String? label, bool replaceLabel = false}) {
final address = addressController.text;
final amount = ref
.read(pAmountFormatter(widget.coin))
.tryParseEditable(amountController.text);
final previous = ref.read(pRecipient(_id));
ref.read(pRecipient(_id).notifier).state = (
can still expect a period, so it rejects the newly formatted amount.

Instead parse using the current locale directly (stack_wallet/lib/pages/send_view/frost_ms/recipient.dart:94), rather than the formatter’s temporarily outdated locale.

The regression tests: mobile and desktop tests (stack_wallet/test/pages/send_view/frost_ms/recipient_test.dart:276) check that:

  • Changing locale preserves the actual amount and recipient name.
  • Editing with commas works.
  • Switching back to periods preserves the amount.
  • Subsequent address edits don’t lose the amount.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 9.68%. Comparing base (8185f05) to head (7270c52).
⚠️ Report is 1 commits behind head on staging.

Additional details and impacted files
@@           Coverage Diff            @@
##           staging    #1476   +/-   ##
========================================
  Coverage     9.67%    9.68%           
========================================
  Files         1129     1129           
  Lines       113551   113554    +3     
========================================
+ Hits         10984    10994   +10     
+ Misses      102567   102560    -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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