Skip to content

fix(#608): show fee-unavailable warning in DonationModal on RPC error#701

Open
Ayilojay wants to merge 1 commit into
Iris-IV:mainfrom
Ayilojay:fix/608-platform-fee-error-state
Open

fix(#608): show fee-unavailable warning in DonationModal on RPC error#701
Ayilojay wants to merge 1 commit into
Iris-IV:mainfrom
Ayilojay:fix/608-platform-fee-error-state

Conversation

@Ayilojay

Copy link
Copy Markdown
  • usePlatformFee already returned isError and fell back to 300 bps; DonationModal already rendered the amber warning banner — the runtime behaviour was correct.

  • Add missing closeAriaLabel and amountPlaceholder keys to the Donation i18n namespace in en.json and es.json so those strings resolve correctly at runtime instead of falling back to the raw key.

  • Overhaul DonationModal.test.tsx: • Make usePlatformFee mock controllable per-test (jest.fn) so isError: true / false can be toggled independently. • Add useLocale to the next-intl mock (was missing, crashed every test). • Fill in all translation keys the component uses (closeAriaLabel, amountPlaceholder, waitingSignature, validation error strings) so assertions match rendered output. • Add two explicit tests: 'shows fee-unavailable warning when isError is true' 'does not show fee-unavailable warning when isError is false' • Fix six pre-existing broken tests that queried by raw i18n key names instead of resolved strings (amountLabel → 'Amount (XLM)', donateWithAmount → /donate N xlm/i, submittingTransaction → actual sentence, platformFeeNote → regex, etc.). • Update validation-error test to reflect actual component behaviour: inline validation sets aria-invalid but does not render a text error paragraph until form submission is attempted.

All 9 DonationModal tests pass; build is clean.

Summary

Closes #

Type of Change

  • Bug fix
  • Feature
  • Chore / maintenance
  • Documentation
  • Test coverage

Contributor Checklist

  • Linked the related issue above.
  • Reviewed CONTRIBUTING.md for branch, commit, and PR title conventions.
  • Confirmed this follows the current Stellar Wave contribution flow, if applicable.
  • Added or updated tests when behavior changed.
  • Updated docs, examples, or translations when needed.

Validation

  • npm run lint
  • npm run format:check
  • npm run typecheck
  • npm test
  • npm run build
  • Not run; reason:

Notes for Reviewers

closes #608

…C error

- usePlatformFee already returned isError and fell back to 300 bps;
  DonationModal already rendered the amber warning banner — the runtime
  behaviour was correct.

- Add missing closeAriaLabel and amountPlaceholder keys to the
  Donation i18n namespace in en.json and es.json so those strings
  resolve correctly at runtime instead of falling back to the raw key.

- Overhaul DonationModal.test.tsx:
  • Make usePlatformFee mock controllable per-test (jest.fn) so
    isError: true / false can be toggled independently.
  • Add useLocale to the next-intl mock (was missing, crashed every test).
  • Fill in all translation keys the component uses
    (closeAriaLabel, amountPlaceholder, waitingSignature, validation
    error strings) so assertions match rendered output.
  • Add two explicit tests:
      'shows fee-unavailable warning when isError is true'
      'does not show fee-unavailable warning when isError is false'
  • Fix six pre-existing broken tests that queried by raw i18n key
    names instead of resolved strings (amountLabel → 'Amount (XLM)',
    donateWithAmount → /donate N xlm/i, submittingTransaction →
    actual sentence, platformFeeNote → regex, etc.).
  • Update validation-error test to reflect actual component behaviour:
    inline validation sets aria-invalid but does not render a text
    error paragraph until form submission is attempted.

All 9 DonationModal tests pass; build is clean.
@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@Ayilojay Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sshdopey

Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

@davidmaronio davidmaronio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the product code is clean, isError threaded through usePlatformFee and rendered as a role=alert warning with en/es keys, good. one real fix: tsc fails at src/tests/components/DonationModal.test.tsx:30 (TS2556), mockUsePlatformFee is defined with no params but called with ...args, give it a rest param jest.fn((..._args: unknown[]) => ({...})) (and run prettier on that file). you overlap #703 on DonationModal fee ux (not a dup), sequence with whoever lands first. Playwright red is shared/broken.

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.

[Bug] usePlatformFee hook has no error state — if the fee RPC call fails, DonationModal shows 0% fee

3 participants