Skip to content

[ON HOLD for Payment 2/24] [$250] Web - Settings - Country is not auto selected in address #56095

Closed

Description

@vincdargento

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: v9.0.92-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Log into an account that does not have a saved address (this step is crucial to replicate the scenario).
  2. Navigate to "Settings" and access the "Private" section in Profile settings
  3. Click on "Address.”

Expected Result:

The country field in the form is auto selected and reflects the user's current location (as indicated in PR #23841)

Actual Result:

Country filed is not auto selected

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021886553288864984378
  • Upwork Job ID: 1886553288864984378
  • Last Price Increase: 2025-02-03
  • Automatic offers:
    • dominictb | Reviewer | 106032491
    • daledah | Contributor | 106032492
Issue OwnerCurrent Issue Owner: @dominictb

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 30, 2025
  2. melvin-bot commented on Jan 30, 2025

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (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. Krishna2323 commented on Jan 30, 2025

    @Krishna2323
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-01-30 17:39:25 UTC.

    Proposal

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

    Web - Settings - Country is not auto selected in address

    What is the root cause of that problem?

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

    • We should first accept a new prop defaultCountry and and update the state to useState(address?.country ?? defaultCountry);.
    • In PersonalAddressPage we can get the country using const [country] = useOnyx(ONYXKEYS.COUNTRY); and pass the country to defaultCountry prop.
    • This can be directly done in AddressPage also.

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

    NA

    What alternative solutions did you explore? (Optional)

    • We can update getCurrentAddress to return the country when address is undefined.
    let defaultCountry = '';
    
    Onyx.connect({
        key: ONYXKEYS.COUNTRY,
        callback: (value) => {
            if (!value) {
                return;
            }
            defaultCountry = value;
        },
    });
    
    /**
     * Get the current address from addresses array
     *
     * @param privatePersonalDetails - details object
     * @returns - current address object
     */
    function getCurrentAddress(privatePersonalDetails: OnyxEntry<PrivatePersonalDetails>): Address | undefined {
        const {addresses} = privatePersonalDetails ?? {};
        const currentAddress = addresses?.find((address) => address.current);
        return currentAddress ?? addresses?.[addresses.length - 1] ?? {country: defaultCountry};
    }

    Result

    Monosnap.screencast.2025-02-04.15-50-47.mp4
  4. melvin-bot commented on Feb 3, 2025

    @melvin-bot

    @CortneyOfstad Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 3, 2025
  6. changed the title [-]Web - Settings - Country is not auto selected in address[/-] [+][$250] Web - Settings - Country is not auto selected in address[/+] on Feb 3, 2025
  7. melvin-bot commented on Feb 3, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 3, 2025
  9. melvin-bot commented on Feb 3, 2025

    @melvin-bot

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

  10. CortneyOfstad commented on Feb 3, 2025

    @CortneyOfstad
    Contributor

    Was able to recreate so getting eyes on this!

    @dominictb — we have one proposal above for your review. Thank you!

  11. 14 remaining items

  12. added
    ReviewingHas a PR in review
    and removed on Feb 8, 2025
  13. CortneyOfstad commented on Feb 11, 2025

    @CortneyOfstad
    Contributor

    PR has great progress! 🎉

  14. CortneyOfstad commented on Feb 19, 2025

    @CortneyOfstad
    Contributor

    PR was pushed to production 2 days ago! For some reason the automatic payment switch didn't happen. Manually adjusting now!

  15. changed the title [-][$250] Web - Settings - Country is not auto selected in address[/-] [+][ON HOLD for Payment 2/24] [$250] Web - Settings - Country is not auto selected in address[/+] on Feb 19, 2025
  16. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed
    ReviewingHas a PR in review
    on Feb 19, 2025
  17. CortneyOfstad commented on Feb 27, 2025

    @CortneyOfstad
    Contributor

    Payment Summary

    @daledah — paid $250 via Upwork
    @dominictb — paid $250 via Upwork

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions