Skip to content

Commit 9fbbe95

Browse files
lakchoteOSBotify
authored andcommitted
Merge pull request #82093 from shubham1206agra/fix-82085
[CP Staging] Fix workspace owner transfer flow not opening (cherry picked from commit 55b28ef) (cherry-picked to staging by lakchote)
1 parent 4eee98d commit 9fbbe95

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import WorkspaceOwnerPaymentCardForm from './WorkspaceOwnerPaymentCardForm';
2525

2626
type WorkspaceOwnerChangeWrapperPageProps = WithPolicyOnyxProps & PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.OWNER_CHANGE_CHECK>;
2727

28-
function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWrapperPageProps) {
28+
function WorkspaceOwnerChangeWrapperPage({route, policy, isLoadingPolicy}: WorkspaceOwnerChangeWrapperPageProps) {
2929
const styles = useThemeStyles();
3030
const {translate} = useLocalize();
3131
const [privateStripeCustomerID] = useOnyx(ONYXKEYS.NVP_PRIVATE_STRIPE_CUSTOMER_ID, {canBeMissing: true});
@@ -39,12 +39,12 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr
3939
const shouldShowPaymentCardForm = error === CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD || isAuthRequired;
4040

4141
useEffect(() => {
42-
if (policy?.isChangeOwnerFailed || policy?.isChangeOwnerSuccessful) {
42+
if (isLoadingPolicy || policy?.isChangeOwnerFailed || policy?.isChangeOwnerSuccessful) {
4343
return;
4444
}
4545
requestWorkspaceOwnerChange(policy, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login ?? '');
4646
// eslint-disable-next-line react-hooks/exhaustive-deps
47-
}, [policyID]);
47+
}, [policyID, isLoadingPolicy]);
4848

4949
useEffect(() => {
5050
if (!policy || policy?.isLoading) {
@@ -72,6 +72,8 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr
7272
}
7373
}, [accountID, backTo, policy, policy?.errorFields?.changeOwner, policyID]);
7474

75+
const isLoading = isLoadingPolicy || !!policy?.isLoading;
76+
7577
return (
7678
<AccessOrNotFoundWrapper
7779
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
@@ -92,9 +94,9 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr
9294
}}
9395
/>
9496
<View style={[styles.containerWithSpaceBetween, error !== CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD ? styles.ph5 : styles.ph0, styles.pb0]}>
95-
{!!policy?.isLoading && <FullScreenLoadingIndicator />}
97+
{isLoading && <FullScreenLoadingIndicator />}
9698
{shouldShowPaymentCardForm && <WorkspaceOwnerPaymentCardForm policy={policy} />}
97-
{!policy?.isLoading && !shouldShowPaymentCardForm && (
99+
{!isLoading && !shouldShowPaymentCardForm && (
98100
<WorkspaceOwnerChangeCheck
99101
policy={policy}
100102
accountID={accountID}

0 commit comments

Comments
 (0)