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] Bank Account - "Please provide a valid website" error is shown #50103

Open
3 of 6 tasks
IuliiaHerets opened this issue Oct 2, 2024 · 6 comments
Open
3 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 2, 2024

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: v9.0.43-2
Reproducible in staging?: Y
Reproducible in production?: Y
Issue was found when executing this PR: #49957
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

  1. Log in to an account
  2. Create a workspace > Enable Workflow > Connect bank account > Connect online with plaid
  3. Continues the flow until you reached "Company website" page
  4. Write invalid email
  5. Click "next"
  6. After the error is show, clear the invalid email and go back.
  7. Return to "Company website" page

Expected Result:

"Please provide a valid website" error is not shown

Actual Result:

"Please provide a valid website" error is shown and it is not dismissed even after navigating back

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6622461_1727894084530.Screen_Recording_2024-10-02_at_3.21.18_in_the_afternoon.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021842647294027107619
  • Upwork Job ID: 1842647294027107619
  • Last Price Increase: 2024-10-05
Issue OwnerCurrent Issue Owner: @ishpaul777
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 2, 2024
Copy link

melvin-bot bot commented Oct 2, 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

@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

@Krishna2323
Copy link
Contributor

Proposal


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

Bank Account - "Please provide a valid website" error is shown

What is the root cause of that problem?

  • When sub step is changed the error is not cleared and the previous page error is shown.

function WebsiteBusiness({onNext, isEditing}: SubStepProps) {

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


  • In WebsiteBusiness, we need to clear the errors when the screen index is changed.
    const formRef = useRef<FormRef | null>(null);
    const prevScreenIndex = usePrevious(screenIndex);
    useEffect(() => {
        if (prevScreenIndex <= screenIndex) {
            return;
        }
        formRef.current?. resetError();
    }, [screenIndex, prevScreenIndex]);

What alternative solutions did you explore? (Optional)

  • We can run a cleanup funciton to clear the message.
  • We might need to do this in multiple sub steps.

What alternative solutions did you explore? (Optional 2)

We can call FormActions.clearErrorFields(formId); & FormActions.clearErrors(formId); in useStepFormSubmit or useReimbursementAccountStepFormSubmit.

export default function useStepFormSubmit<T extends keyof OnyxFormValuesMapping>({formId, onNext, fieldIds, shouldSaveDraft}: UseStepFormSubmitParams<T>) {
return useCallback(
(values: FormOnyxValues<T>) => {
if (shouldSaveDraft) {
const stepValues = fieldIds.reduce((acc, key) => {
acc[key] = values[key];
return acc;
}, {} as Record<TupleToUnion<typeof fieldIds>, OnyxValues[T][Exclude<keyof OnyxValues[T], keyof BaseForm>]>);
FormActions.setDraftValues(formId, stepValues);
onNext(stepValues);
return;
}
onNext();
},
[onNext, formId, fieldIds, shouldSaveDraft],
);
}

What alternative solutions did you explore? (Optional 3)

Result

@mkzie2
Copy link
Contributor

mkzie2 commented Oct 3, 2024

Proposal

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

  • "Please provide a valid website" error is shown and it is not dismissed even after navigating back

What is the root cause of that problem?

  • The company website is a step that occurs after the company tax step.

  • When starting the bank account setup and reaching the company tax page, clicking the "Next" button triggers the UpdateCompanyInformationForBankAccount function, passing the website data as "". No error is returned by the backend here.

  • Next, it redirects to the company website page. If you input something like "https://123" and then reset it to "https://", the system saves website: "https://" in the reimbursementAccountDraft.

  • When navigating back to the company tax page, clicking the "Next" button again triggers UpdateCompanyInformationForBankAccount with the website data as "https://", which is an invalid value. As a result, the backend returns an Onyx error:

{
    "onyxMethod": "merge",
    "key": "reimbursementAccount",
    "value": {
        "errors": {
            "1727918521418387": "Please provide a valid Website"
        }
    }
}
  • So the "Please provide a valid Website" error message is shown.

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

  • When we are in company website page and go back, we need to clear the reimbursementAccountDraft.website if its value is https://.

  • So in here we introduce a ref const websiteRef = useRef() to keep track the company website input. Then add onChangeText={(t) => (websiteRef.current = t)} to InputWrapper.

  • Finally, add cleanup function:

    useEffect(() => {
        return () => {
            if (defaultWebsiteExample === websiteRef.current) {
                BankAccounts.addBusinessWebsiteForDraft(null);
            }
        };
    }, []);

What alternative solutions did you explore? (Optional)

  • The above useEffect can be:
    useEffect(() => {
        return () => {
            if (!ValidationUtils.isValidWebsite(values.website)) {
                BankAccounts.addBusinessWebsiteForDraft(null);
            }
        };
    }, []);

@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2024
@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Oct 5, 2024
Copy link

melvin-bot bot commented Oct 5, 2024

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

@melvin-bot melvin-bot bot changed the title Bank Account - "Please provide a valid website" error is shown [$250] Bank Account - "Please provide a valid website" error is shown Oct 5, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 5, 2024
Copy link

melvin-bot bot commented Oct 5, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Oct 5, 2024
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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
Development

No branches or pull requests

5 participants