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

[$250] Address - Address without state can be saved #47616

Closed
6 tasks done
IuliiaHerets opened this issue Aug 18, 2024 · 25 comments
Closed
6 tasks done

[$250] Address - Address without state can be saved #47616

IuliiaHerets opened this issue Aug 18, 2024 · 25 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Aug 18, 2024

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.21-3
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Account settings > Profile > Address.
  3. Select a US address.
  4. Click Country and select United Kingdom.
  5. Enter anything in State field and click Save (ignore the incorrect zip code).
  6. Click Country and select United States.
  7. Without selecting State, click Save.

Expected Result:

App should not be able to save address without state.

Actual Result:

The address without state can be saved

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

Bug6575237_1723986353394.20240818_210053.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0142ffeec763fcd562
  • Upwork Job ID: 1828601412039191657
  • Last Price Increase: 2024-08-28
  • Automatic offers:
    • abzokhattab | Contributor | 103745348
Issue OwnerCurrent Issue Owner: @aimane-chnaif
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 18, 2024
Copy link

melvin-bot bot commented Aug 18, 2024

Triggered auto assignment to @anmurali (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.

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@IuliiaHerets
Copy link
Author

@anmurali FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@abzokhattab
Copy link
Contributor

abzokhattab commented Aug 18, 2024

Edited by proposal-police: This proposal was edited at 2024-08-18 22:28:21 UTC.

Proposal

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

Address without state can be saved

What is the root cause of that problem?

The defaultValue prop is used in the state component of the AddressForm instead of value. As a result, when the value of the country changes, the state resets to "" here, but this change isn't reflected in the UI because defaultValue only sets the initial value.

<View style={styles.mhn5}>
<InputWrapper
InputComponent={StateSelector}
inputID={INPUT_IDS.STATE}
defaultValue={state}
onValueChange={onAddressChanged}
shouldSaveDraft={shouldSaveDraft}
/>
</View>

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

We should use value instead of defaultValue in the StatePicker component, and adjust other components if necessary.

POC

Screen.Recording.2024-08-19.at.12.21.51.AM.mov

@wildan-m
Copy link
Contributor

Proposal

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

Address without state can still be saved.

What is the root cause of that problem?

We don't use defaultValue when we validate the form

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

We can add shouldUseDefaultValue here:

<InputWrapper
InputComponent={StateSelector}
inputID={INPUT_IDS.STATE}
defaultValue={state}
onValueChange={onAddressChanged}
shouldSaveDraft={shouldSaveDraft}
/>

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

@anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Aug 26, 2024

@anmurali Still overdue 6 days?! Let's take care of this!

@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0142ffeec763fcd562

@melvin-bot melvin-bot bot changed the title Address - Address without state can be saved [$250] Address - Address without state can be saved Aug 28, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2024
@brad-isbell
Copy link

brad-isbell commented Aug 28, 2024

Proposal

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

Address without state can be saved

What is the root cause of that problem?

using defaultValue instead of value causes the state InputWrapper component here to not rerender when the state variable changes.

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

we should change defaultValue to value and pass the state variable. I also made some adjustments here so that we use only one component instead of two when the county is USA or any other country.

            <View style={isUSAForm ? styles.mhn5 : {}}>
                <InputWrapper
                    InputComponent={isUSAForm ? StateSelector : TextInput}
                    inputID={INPUT_IDS.STATE}
                    label={translate('common.stateOrProvince')}
                    aria-label={translate('common.stateOrProvince')}
                    role={isUSAForm ? CONST.ROLE.PRESENTATION : undefined}
                    value={state}
                    maxLength={isUSAForm ? CONST.FORM_CHARACTER_LIMIT : undefined}
                    spellCheck={!isUSAForm}
                    onValueChange={onAddressChanged}
                    shouldSaveDraft={shouldSaveDraft}
                />
            </View>

What alternative solutions did you explore? (Optional)

Result:
https://github.com/user-attachments/assets/a5a644e8-c0f5-4898-a2e2-d2d2e0c54456

Copy link

melvin-bot bot commented Aug 28, 2024

📣 @brad-isbell! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@brad-isbell
Copy link

Contributor details
Your Expensify account email: mohamediyedrhimita@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01e11da7d5ef514a1c

Copy link

melvin-bot bot commented Aug 28, 2024

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@aimane-chnaif
Copy link
Contributor

@abzokhattab's proposal looks good to me.
It's weird that defaultValue is passed in state selector, while value is passed in country selector in current codebase.
🎀👀🎀 C+ reviewed

shouldUseDefaultValue can be alternative option but I prefer using value since it's consistent with country selector.
I see that @wildan-m raised discussion on slack but no one responded. I bumped in channel.

Copy link

melvin-bot bot commented Aug 29, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 30, 2024
Copy link

melvin-bot bot commented Aug 30, 2024

📣 @abzokhattab 🎉 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 📖

Copy link

melvin-bot bot commented Sep 1, 2024

@anmurali @techievivek @abzokhattab @aimane-chnaif this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Sep 1, 2024
@aimane-chnaif
Copy link
Contributor

Waiting for PR

@melvin-bot melvin-bot bot removed the Overdue label Sep 2, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 2, 2024
@abzokhattab
Copy link
Contributor

PR is Ready

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Sep 26, 2024
Copy link

melvin-bot bot commented Sep 26, 2024

This issue has not been updated in over 15 days. @anmurali, @techievivek, @abzokhattab, @aimane-chnaif eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@techievivek
Copy link
Contributor

I think this is ready for the payment, right? I don't see a message deployed to production, but I am guessing that must be a glitch with the automation. cc @abzokhattab @aimane-chnaif

@abzokhattab
Copy link
Contributor

Correct.

@techievivek
Copy link
Contributor

@anmurali Can we finish the payment here? Thanks.

@aimane-chnaif
Copy link
Contributor

Regression Test Proposal

  1. Go to Account settings > Profile > Address.
  2. Select a US address.
  3. Click Country and select United Kingdom.
  4. Enter anything in State field and click Save (ignore the incorrect zip code).
  5. Click Country and select United States.
  6. Without selecting State, click Save.
  7. Verify that the "State" field is empty after selecting the U.S. again, and when you click "Save," an error message appears indicating that the state is invalid.

@anmurali
Copy link

anmurali commented Oct 17, 2024

Payment Summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2 Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

7 participants