-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix company's website step is skipped #46940
Fix company's website step is skipped #46940
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
src/components/Form/FormProvider.tsx
Outdated
@@ -249,7 +253,7 @@ function FormProvider( | |||
} else if (inputProps.shouldUseDefaultValue && inputProps.defaultValue !== undefined && inputValues[inputID] === undefined) { | |||
// We force the form to set the input value from the defaultValue props if there is a saved valid value | |||
inputValues[inputID] = inputProps.defaultValue; | |||
} else if (inputValues[inputID] === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just did some testing to see if this change affects other forms in the app and I found an issue in the money request merchant page.
e.mp4
From the video above, you can see that when I try to clear the merchant, the value always reverted back to the saved merchant, so, I believe we can't change this to check for an empty string.
I have reverted this change and instead reset the website to undefined instead of an empty string.
@@ -15,7 +16,7 @@ function getInitialSubstepForBusinessInfo(data: CompanyStepProps): number { | |||
return 1; | |||
} | |||
|
|||
if (data[businessInfoStepKeys.COMPANY_WEBSITE] === '') { | |||
if (data[businessInfoStepKeys.COMPANY_WEBSITE] === '' || !ValidationUtils.isValidWebsite(data[businessInfoStepKeys.COMPANY_WEBSITE])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (data[businessInfoStepKeys.COMPANY_WEBSITE] === '' || !ValidationUtils.isValidWebsite(data[businessInfoStepKeys.COMPANY_WEBSITE])) { | |
if (!ValidationUtils.isValidWebsite(data[businessInfoStepKeys.COMPANY_WEBSITE])) { |
Function isValidWebsite
also cover an empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, updated!
onConfirm={() => BankAccounts.resetFreePlanBankAccount(bankAccountID, session, achData?.policyID ?? '-1', user)} | ||
onConfirm={() => BankAccounts.resetFreePlanBankAccount(bankAccountID, session, achData?.policyID ?? '-1')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user
is used before for the default website.
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: getDefaultCompanyWebsite(session, user), |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-08.at.01.46.21.mp4Android: mWeb ChromeScreen.Recording.2024-08-08.at.01.48.02.mp4iOS: NativeScreen.Recording.2024-08-08.at.01.45.43.mp4iOS: mWeb SafariScreen.Recording.2024-08-08.at.01.43.27.mp4MacOS: Chrome / SafariScreen.Recording.2024-08-08.at.01.40.29.mp4MacOS: DesktopScreen.Recording.2024-08-08.at.01.39.46.mp4 |
@@ -98,7 +97,7 @@ function resetFreePlanBankAccount(bankAccountID: number | undefined, session: On | |||
[INPUT_IDS.BUSINESS_INFO_STEP.STATE]: '', | |||
[INPUT_IDS.BUSINESS_INFO_STEP.ZIP_CODE]: '', | |||
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_PHONE]: '', | |||
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: getDefaultCompanyWebsite(session, user), | |||
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: undefined, | |
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: '', |
NAB: The defaultCompanyWebsite has changed from ??
to ||
so we can use empty string for that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value reset here is for the form draft, so it does have no effect on defaultCompanyWebsite
. If we use an empty string, then the default value won't be applied.
App/src/components/Form/FormProvider.tsx
Lines 252 to 255 in 53eee53
} else if (inputValues[inputID] === undefined) { | |
// We want to initialize the input value if it's undefined | |
inputValues[inputID] = inputProps.defaultValue ?? getInitialValueByType(inputProps.valueType); | |
} |
I updated the defaultCompanyWebsite
from ??
to ||
because reimbursementAccount?.achData?.website
is a string, so I think it's safer to use ||
. Do you think we should just revert that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bernhardoj I got it, we can revert change the defaultCompanyWebsite
from ??
to ||
and keep this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: Would null be better to remove the key from Onyx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with just a minor change request that’s not a blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good and it looks like it tests well. Thanks.
@@ -98,7 +97,7 @@ function resetFreePlanBankAccount(bankAccountID: number | undefined, session: On | |||
[INPUT_IDS.BUSINESS_INFO_STEP.STATE]: '', | |||
[INPUT_IDS.BUSINESS_INFO_STEP.ZIP_CODE]: '', | |||
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_PHONE]: '', | |||
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: getDefaultCompanyWebsite(session, user), | |||
[INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: Would null be better to remove the key from Onyx?
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
FYI I believe this was deployed to prod yesterday, from this checklist - #47219 |
Details
The website step on bank account setup is skipped. This PR fix it.
Fixed Issues
$ #45283
PROPOSAL: #45283 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4