Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2023-10-30] Profile - 'Country' doesn't change if selected manually and then another suggested address is selected #29382

Closed
3 of 6 tasks
lanitochka17 opened this issue Oct 11, 2023 · 36 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 11, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.3.81-6

Reproducible in staging?: Yes

Reproducible in production?: Yes

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: Applause - Internal Team

Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com or open Expensify App (iOS, Android, Desktop)
  2. Login with any account
  3. Go to Settings > Profile > Personal details > Home address
  4. Select any country
  5. Start type any address in Address Line 1
  6. Select any suggested address in another country

Expected Result:

All fields are filled in correctly. Country replaced with the suggested one

Actual Result:

The “Country” field has not changed and remains the same as it was previously selected manually

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop
Bug6233524_1697053961845.Desktop-Selected-County-not-change-to-suggested.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0192336d38fb4edbd9
  • Upwork Job ID: 1712810996160061440
  • Last Price Increase: 2023-10-13
  • Automatic offers:
    • 0xmiroslav | Reviewer | 27241875
    • ishpaul777 | Contributor | 27241878
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

Triggered auto assignment to @laurenreidexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@ishpaul777
Copy link
Contributor

ishpaul777 commented Oct 11, 2023

Proposal

Problem

'Country' not change if select it manually and then select another suggested address

Root Cause

In useEffect of AddressPage we have added a dependecy for currentCountry so even when the address country is changed when a auto suggested address in clicked it get overridden by country from url Param.

Changes

We can safely remove currentCountry from url so the useEffect run only on componentmount and url param change but not when currentCountry change.

@alitoshmatov
Copy link
Contributor

Proposal

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

Profile - 'Country' not change if select it manually and then select another suggested address

What is the root cause of that problem?

When we select country from country list, selected country is stored in route data. And we have this piece of code to retrieve this data from route and set local state

useEffect(() => {
if (!countryFromUrl || countryFromUrl === currentCountry) {
return;
}
handleAddressChange(countryFromUrl, 'country');
}, [countryFromUrl, handleAddressChange, currentCountry]);

Notice that currentCountry is also in a dependency list. So when autocomplete changes country it will trigger above useEffect and it will read countryFromUrl and set it to current country reverting the changes.

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

We should remove currentCountry from dependency list, and I think we can also remove countryFromUrl === currentCountry condition which won't affect expected behavior. So at the end, this useEffect is triggered only if country in route is changed

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 12, 2023

Proposal

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

Profile - 'Country' not change if select it manually and then select another suggested address

What is the root cause of that problem?

When the user selects a country from the country list, we will set the selected country to route. But when the country is completed automatically by Google API, we don't reset the country in the route. So that the country in route will override the selected country

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

When a country is changed automatically by Google API (clicking suggestion from address line 1), we should reset the route to settings/profile/personal-details/address

In here:

onValueChange={handleAddressChange}

We should update like this

onValueChange={(value, key)=> {
                                if (countryFromUrl) {
                                    Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS)
                                }
                                handleAddressChange(value, key)
                            }}

As mentioned here #29382 (comment) We also remove the redundant call by removing currentCountry here

}, [countryFromUrl, handleAddressChange, currentCountry]);

Result

Screen.Recording.2023-10-16.at.22.04.06.mov

@laurenreidexpensify laurenreidexpensify added the External Added to denote the issue can be worked on by a contributor label Oct 13, 2023
@melvin-bot melvin-bot bot changed the title Profile - 'Country' not change if select it manually and then select another suggested address [$500] Profile - 'Country' not change if select it manually and then select another suggested address Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0192336d38fb4edbd9

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

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

@laurenreidexpensify laurenreidexpensify changed the title [$500] Profile - 'Country' not change if select it manually and then select another suggested address Profile - 'Country' doesn't change if selected manually and then another suggested address is selected Oct 13, 2023
@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@laurenreidexpensify
Copy link
Contributor

@0xmiroslav what you think of the proposals above?

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@0xmiros
Copy link
Contributor

0xmiros commented Oct 16, 2023

@alitoshmatov's proposal looks good to me.
I think it's fine not resetting route when country is changed from dropdown.
🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@DylanDylann
Copy link
Contributor

@0xmiroslav A bit curious, With @alitoshmatov's #29382 (comment) proposal, When we select new address line 1 the country will update but the country in the url still be old value.

@0xmiros
Copy link
Contributor

0xmiros commented Oct 16, 2023

@DylanDylann I added explanation:

I think it's fine not resetting route when country is changed from dropdown.

@DylanDylann
Copy link
Contributor

Sorry I miss it, If we remain the wrong url, user will be get wrong information when reloading

@0xmiros
Copy link
Contributor

0xmiros commented Oct 16, 2023

Good point but we should optimize code as well. There's redundant call of handleAddressChange when selected from autocomplete suggestion.

we should reset the route to settings/profile/personal-details/address

How will you reset this root manually though?

@ishpaul777
Copy link
Contributor

ishpaul777 commented Oct 16, 2023

hii @0xmiroslav my proposal was before the selected proposal and suggest enough to solve the problem, selected proposal has a minor change with no effect over the functionality

I think we can also remove countryFromUrl === currentCountry condition which won't affect expected behavior.

@0xmiros
Copy link
Contributor

0xmiros commented Oct 16, 2023

We can safely remove currentCountry from url

@ishpaul777 your solution was this one, am I wrong?

@ishpaul777
Copy link
Contributor

omg this was a typo! sorry for confusion but my intent was to remove from dependency list,

@DylanDylann
Copy link
Contributor

DylanDylann commented Oct 16, 2023

How will you reset this root manually though?

@0xmiroslav Updated proposal for more detail

@0xmiros
Copy link
Contributor

0xmiros commented Oct 16, 2023

Still I am not inclined to force update route on the same page as we don't have this pattern yet in the app. (@DylanDylann tell me if you found any)

@lakchote
Copy link
Contributor

I would prefer not having to update the route. It would be an edge case that on reload the user gets wrong information.
On the other hand, by not updating the route we avoid performance overheads. When looking at the video, we can see for a second the UI is frozen when selecting the address and updating the country which is not ideal IMO.

@0xmiros
Copy link
Contributor

0xmiros commented Oct 17, 2023

@lakchote thanks for feedback.

In this case, I think we can go with @ishpaul777 to be fair as it was just a typo url -> dependency.
Though that one typo had completely different meaning 🙂

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

📣 @0xmiroslav 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@laurenreidexpensify
Copy link
Contributor

@ishpaul777 do we have a draft PR up yet? Thanks!

@ishpaul777
Copy link
Contributor

Sorry for not giving ETA. I am working on it will raise a PR by the end of today(wednesday).

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 18, 2023
@ishpaul777
Copy link
Contributor

@0xmiroslav PR is up for your review, please take a look when you get the chance, Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

🎯 ⚡️ Woah @0xmiroslav / @ishpaul777, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @ishpaul777 got assigned: 2023-10-17 15:12:20 Z
  • when the PR got merged: 2023-10-19 07:24:41 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 23, 2023
@melvin-bot melvin-bot bot changed the title Profile - 'Country' doesn't change if selected manually and then another suggested address is selected [HOLD for payment 2023-10-30] Profile - 'Country' doesn't change if selected manually and then another suggested address is selected Oct 23, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.88-11 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 2023-10-30. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@0xmiroslav] The PR that introduced the bug has been identified. Link to the PR:
  • [@0xmiroslav] 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:
  • [@0xmiroslav] A discussion in #expensify-bugs 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:
  • [@0xmiroslav] Determine if we should create a regression test for this bug.
  • [@0xmiroslav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@laurenreidexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 29, 2023
@laurenreidexpensify
Copy link
Contributor

laurenreidexpensify commented Oct 30, 2023

Payment Summary:

  • External issue reporter - Applause N/A
  • Contributor that fixed the issue - @ishpaul777 - $500 + $250, payment issued in Upwork
  • Contributor+ that helped on the issue and/or PR - @0xmiroslav - $500 + $250, payment issued in Upwork

@laurenreidexpensify
Copy link
Contributor

Wait @0xmiroslav can you confirm if it's Upwork or NewDot for payment for you? Thanks

@0xmiros
Copy link
Contributor

0xmiros commented Oct 30, 2023

upwork yet

@0xmiros
Copy link
Contributor

0xmiros commented Oct 30, 2023

  • The PR that introduced the bug has been identified. Link to the PR: Implement dedicated route for CountryPicker in AddressPage #26742
  • 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/26742/files#r1376069662
  • A discussion in #expensify-bugs 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
  • Determine if we should create a regression test for this bug. This was caught by Applause team so no need additional regression test
  • If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants