Skip to content

Commit 148b509

Browse files
authored
Merge pull request Expensify#76541 from shubham1206agra/fix-owner-transfer
[CP Staging] Fixed owner transfer flow
2 parents b3d557c + f54c7b9 commit 148b509

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
344344
const startChangeOwnershipFlow = useCallback(() => {
345345
clearWorkspaceOwnerChangeFlow(policyID);
346346
requestWorkspaceOwnerChange(policyID, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login ?? '');
347-
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, currentUserPersonalDetails.accountID, 'amountOwed' as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
348-
}, [currentUserPersonalDetails.accountID, currentUserPersonalDetails.login, policyID]);
347+
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, 'amountOwed' as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
348+
}, [accountID, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login, policyID]);
349349

350350
// eslint-disable-next-line rulesdir/no-negated-variables
351351
const shouldShowNotFoundPage =

src/pages/workspace/members/WorkspaceOwnerChangeCheck.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {ValueOf} from 'type-fest';
55
import Button from '@components/Button';
66
import {usePersonalDetails} from '@components/OnyxListItemProvider';
77
import Text from '@components/Text';
8+
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
89
import useLocalize from '@hooks/useLocalize';
910
import useThemeStyles from '@hooks/useThemeStyles';
1011
import {clearWorkspaceOwnerChangeFlow, requestWorkspaceOwnerChange} from '@libs/actions/Policy/Member';
@@ -28,6 +29,7 @@ type WorkspaceOwnerChangeCheckProps = {
2829
function WorkspaceOwnerChangeCheck({policy, accountID, error}: WorkspaceOwnerChangeCheckProps) {
2930
const styles = useThemeStyles();
3031
const {translate} = useLocalize();
32+
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
3133
const [displayTexts, setDisplayTexts] = useState({
3234
title: '',
3335
text: '',
@@ -64,8 +66,8 @@ function WorkspaceOwnerChangeCheck({policy, accountID, error}: WorkspaceOwnerCha
6466
return;
6567
}
6668

67-
requestWorkspaceOwnerChange(policyID, accountID, userPersonalDetails?.login ?? '');
68-
}, [accountID, error, policyID, userPersonalDetails?.login]);
69+
requestWorkspaceOwnerChange(policyID, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login ?? '');
70+
}, [accountID, error, policyID, currentUserPersonalDetails.accountID, currentUserPersonalDetails.login]);
6971

7072
return (
7173
<>

src/pages/workspace/members/WorkspaceOwnerChangeWrapperPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function WorkspaceOwnerChangeWrapperPage({route, policy}: WorkspaceOwnerChangeWr
3030
const [privateStripeCustomerID] = useOnyx(ONYXKEYS.NVP_PRIVATE_STRIPE_CUSTOMER_ID, {canBeMissing: true});
3131
const [fundList] = useOnyx(ONYXKEYS.FUND_LIST, {canBeMissing: true});
3232
const policyID = route.params.policyID;
33-
const accountID = route.params.accountID;
33+
const accountID = Number(route.params.accountID);
3434
const error = route.params.error;
3535
const backTo = route.params.backTo;
3636
const isAuthRequired = privateStripeCustomerID?.status === CONST.STRIPE_SCA_AUTH_STATUSES.CARD_AUTHENTICATION_REQUIRED;

0 commit comments

Comments
 (0)