Skip to content

[HOLD for payment 2025-02-07] [$250] Subscription: Currency selected incorrectly after page reload #55569

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.88-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation (hyperlinked to channel name): expensify_bugs

Action Performed:

  1. Go to Subscription page
  2. Click Add payment card
  3. Change currency to AUD
  4. Reload page
  5. Observe currency it has been reset to USD
  6. Click on currency field

Expected Result:

USD option is selected

Actual Result:

AUD option is selected

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
bug.mov
Recording.915.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021881985646640917256
  • Upwork Job ID: 1881985646640917256
  • Last Price Increase: 2025-01-22
  • Automatic offers:
    • DylanDylann | Reviewer | 105877710
    • ikevin127 | Contributor | 105877713
Issue OwnerCurrent Issue Owner: @dylanexpensify

Activity

  1. added
    Bug
    Daily
    on Jan 21, 2025
  2. melvin-bot commented on Jan 21, 2025

    @melvin-bot

    Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. daledah commented on Jan 21, 2025

    @daledah
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Currency selected incorrectly after page reload

    What is the root cause of that problem?

    Because we previously set the currency to AUD, when reloading, the debitCardForm here still has the currency as AUD even though Onyx has updated it to USD.

    const [debitCardForm] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM);

    What changes do you think we should make in order to solve the problem?

    we should add option initWithStoredValues ​​as false similar to what we did elsewhere

        const [debitCardForm] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM, {initWithStoredValues: false});
    

    We can do the same with pages that have similar problems.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. added
    External
    on Jan 22, 2025
  5. changed the title [-]Subscription: Currency selected incorrectly after page reload[/-] [+][$250] Subscription: Currency selected incorrectly after page reload[/+] on Jan 22, 2025
  6. melvin-bot commented on Jan 22, 2025

    @melvin-bot
  7. added
    Help Wanted
    on Jan 22, 2025
  8. melvin-bot commented on Jan 22, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (External)

  9. DylanDylann commented on Jan 22, 2025

    @DylanDylann
    Contributor

    @daledah's proposal looks good to me. To ensure that the previous state does not impact the rendering of the current page, we need to set initWithStoredValues to false

    🎀 👀 🎀 C+ Reviewed

  10. melvin-bot commented on Jan 22, 2025

    @melvin-bot

    Triggered auto assignment to @neil-marcellini, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  11. 30 remaining items

  12. removed
    Reviewing
    on Jan 31, 2025
  13. melvin-bot commented on Jan 31, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Jan 31, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.92-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-02-07. 🎊

    For reference, here are some details about the assignees on this issue:

  15. melvin-bot commented on Jan 31, 2025

    @melvin-bot

    @ikevin127 / @DylanDylann @dylanexpensify @ikevin127 / @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  16. ikevin127 commented on Jan 31, 2025

    @ikevin127
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/43572/files#r1938168677.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A.

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition: Have at least one WS created in order to have the Subscription section show-up in Settings.

    1. Go to Subscription page.
    2. Click Add payment card (does not apply on Native [no support]).
    3. Change currency to AUD (or any other than default USD).
    4. Reload page (only applies to Web / mWeb and Desktop).
    5. Verify that the currency will be reset to USD in both Add payment card and Change payment currency pages.

    Do we agree 👍 or 👎.

  17. DylanDylann commented on Feb 1, 2025

    @DylanDylann
    Contributor

    @ikevin127 Thanks so much

  18. drminh2807 commented on Feb 3, 2025

    @drminh2807
    Contributor

    @drminh2807 Thanks for your explanation, your RCA explained why the cache is outdated. But I feel your solution is unsafe to me and It seems like workarounds @daledah Your proposal will make value in the currency page always the default @ikevin127 Your proposal looks good to me. A bit explained, because we return null when loading Onyx data, the cache should also be updated with the correct value when data is loaded. And we still can use cached value with the correct data

    🎀 👀 🎀 C+ Reviewed

    ikevin's solution is correct
    but the RCA is unclear
    Actually I think it was a fluke, because blocking the rendering of the entire form before the data was called, accidentally blocked CurrencyField from calling Form.clearError
    I spent all day trying to figure out the RCA and help you guys identify the correct solution. Don't I deserve a reward? @neil-marcellini

  19. dylanexpensify commented on Feb 5, 2025

    @dylanexpensify
    Contributor

    coming up!

  20. added
    Daily
    and removed
    Weekly
    on Feb 6, 2025
  21. neil-marcellini commented on Feb 6, 2025

    @neil-marcellini
    Contributor

    We went with @ikevin127's solution and @DylanDylann was the C+ so they will be paid. @drminh2807 we definitely appreciate your help but I'm not sure it warrants payment unless there's some phrasing about this in our documentation I'm not aware of. I'll let @dylanexpensify make the final decision since he's in charge of payment.

  22. dylanexpensify commented on Feb 6, 2025

    @dylanexpensify
    Contributor

    Payment summary:

    Contributor: @ikevin127 $250 via Upwork
    Contributor+: @DylanDylann $250 via Upwork

    Please apply/request!

  23. dylanexpensify commented on Feb 7, 2025

    @dylanexpensify
    Contributor

    All done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions