@@ -28,6 +28,7 @@ import CONST from '@src/CONST';
28
28
import type { OnboardingAccounting } from '@src/CONST' ;
29
29
import ONYXKEYS from '@src/ONYXKEYS' ;
30
30
import type { } from '@src/types/onyx/Bank' ;
31
+ import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue' ;
31
32
import type { BaseOnboardingAccountingProps } from './types' ;
32
33
33
34
type OnboardingListItem = ListItem & {
@@ -45,7 +46,7 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding
45
46
const { onboardingIsMediumOrLargerScreenWidth, isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
46
47
const [ onboardingValues ] = useOnyx ( ONYXKEYS . NVP_ONBOARDING ) ;
47
48
const [ onboardingPurposeSelected ] = useOnyx ( ONYXKEYS . ONBOARDING_PURPOSE_SELECTED ) ;
48
- const [ onboardingPolicyID ] = useOnyx ( ONYXKEYS . ONBOARDING_POLICY_ID ) ;
49
+ const [ onboardingPolicyID , onboardingPolicyIDResult ] = useOnyx ( ONYXKEYS . ONBOARDING_POLICY_ID ) ;
49
50
const [ onboardingAdminsChatReportID ] = useOnyx ( ONYXKEYS . ONBOARDING_ADMINS_CHAT_REPORT_ID ) ;
50
51
const [ onboardingCompanySize ] = useOnyx ( ONYXKEYS . ONBOARDING_COMPANY_SIZE ) ;
51
52
const { canUseDefaultRooms} = usePermissions ( ) ;
@@ -58,14 +59,14 @@ function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboarding
58
59
// If the signupQualifier is VSB, the company size step is skip.
59
60
// So we need to create the new workspace in the accounting step
60
61
useEffect ( ( ) => {
61
- if ( ! isVsb || ! ! onboardingPolicyID ) {
62
+ if ( ! isVsb || ! ! onboardingPolicyID || isLoadingOnyxValue ( onboardingPolicyIDResult ) ) {
62
63
return ;
63
64
}
64
65
65
66
const { adminsChatReportID, policyID} = Policy . createWorkspace ( undefined , true , '' , Policy . generatePolicyID ( ) , CONST . ONBOARDING_CHOICES . MANAGE_TEAM ) ;
66
67
Welcome . setOnboardingAdminsChatReportID ( adminsChatReportID ) ;
67
68
Welcome . setOnboardingPolicyID ( policyID ) ;
68
- } , [ isVsb , onboardingPolicyID ] ) ;
69
+ } , [ isVsb , onboardingPolicyID , onboardingPolicyIDResult ] ) ;
69
70
70
71
const accountingOptions : OnboardingListItem [ ] = useMemo ( ( ) => {
71
72
const policyAccountingOptions = Object . values ( CONST . POLICY . CONNECTIONS . NAME )
0 commit comments