From 900d2fa8f008278d0370eedebd751e6fa65b43e2 Mon Sep 17 00:00:00 2001 From: Vit Horacek <36083550+mountiny@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:37:15 +0200 Subject: [PATCH] Merge pull request #48731 from bernhardoj/fix/48674-default-website-isn't-saved-to-draft [CP Staging] Fix company website field is blank on confirmation page if it is not modified (cherry picked from commit 41707cbc644f95d7fda72cf5e8c70c7f6d52d27b) (CP triggered by mountiny) --- .../BusinessInfo/substeps/WebsiteBusiness.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx index a2d1f245152f..ed360dc68842 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/WebsiteBusiness.tsx @@ -1,4 +1,4 @@ -import React, {useCallback, useMemo} from 'react'; +import React, {useCallback, useEffect, useMemo} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import FormProvider from '@components/Form/FormProvider'; @@ -12,6 +12,7 @@ import type {SubStepProps} from '@hooks/useSubStep/types'; import useThemeStyles from '@hooks/useThemeStyles'; import {getDefaultCompanyWebsite} from '@libs/BankAccountUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; +import * as BankAccounts from '@userActions/BankAccounts'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import INPUT_IDS from '@src/types/form/ReimbursementAccountForm'; @@ -58,6 +59,10 @@ function WebsiteBusiness({reimbursementAccount, user, session, onNext, isEditing shouldSaveDraft: isEditing, }); + useEffect(() => { + BankAccounts.addBusinessWebsiteForDraft(defaultCompanyWebsite); + }, [defaultCompanyWebsite]); + return (