From fbc8be1a9166f752667f0d448c7a2e47e605f0ee Mon Sep 17 00:00:00 2001 From: truph01 Date: Thu, 7 Nov 2024 10:33:59 +0700 Subject: [PATCH] fix: remove withOnyx --- src/pages/workspace/WorkspaceInvitePage.tsx | 32 ++++----------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index 23a90b4afd3e..ce3dc37d52b9 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -2,7 +2,7 @@ import {useNavigation} from '@react-navigation/native'; import type {StackScreenProps} from '@react-navigation/stack'; import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import type {SectionListData} from 'react-native'; -import {useOnyx, withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -44,20 +44,9 @@ import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscree type MembersSection = SectionListData>; -type WorkspaceInvitePageOnyxProps = { - /** Beta features list */ - betas: OnyxEntry; +type WorkspaceInvitePageProps = WithPolicyAndFullscreenLoadingProps & WithNavigationTransitionEndProps & StackScreenProps; - /** An object containing the accountID for every invited user email */ - invitedEmailsToAccountIDsDraft: OnyxEntry; -}; - -type WorkspaceInvitePageProps = WithPolicyAndFullscreenLoadingProps & - WithNavigationTransitionEndProps & - WorkspaceInvitePageOnyxProps & - StackScreenProps; - -function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, policy}: WorkspaceInvitePageProps) { +function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const navigation = useNavigation(); @@ -68,6 +57,8 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli const [didScreenTransitionEnd, setDidScreenTransitionEnd] = useState(false); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false}); const firstRenderRef = useRef(true); + const [betas] = useOnyx(ONYXKEYS.BETAS); + const [invitedEmailsToAccountIDsDraft] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${route.params.policyID.toString()}`); const openWorkspaceInvitePage = () => { const policyMemberEmailsToAccountIDs = PolicyUtils.getMemberAccountIDsForWorkspace(policy?.employeeList); @@ -357,15 +348,4 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli WorkspaceInvitePage.displayName = 'WorkspaceInvitePage'; -export default withNavigationTransitionEnd( - withPolicyAndFullscreenLoading( - withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, - invitedEmailsToAccountIDsDraft: { - key: ({route}) => `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${route.params.policyID.toString()}`, - }, - })(WorkspaceInvitePage), - ), -); +export default withNavigationTransitionEnd(withPolicyAndFullscreenLoading(WorkspaceInvitePage));