Skip to content

Commit

Permalink
fix: remove withOnyx
Browse files Browse the repository at this point in the history
  • Loading branch information
truph01 committed Nov 7, 2024
1 parent 3d9e7be commit fbc8be1
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions src/pages/workspace/WorkspaceInvitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Check failure on line 6 in src/pages/workspace/WorkspaceInvitePage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'OnyxEntry' is defined but never used
import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand Down Expand Up @@ -44,20 +44,9 @@ import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscree

type MembersSection = SectionListData<MemberForList, Section<MemberForList>>;

type WorkspaceInvitePageOnyxProps = {
/** Beta features list */
betas: OnyxEntry<Beta[]>;
type WorkspaceInvitePageProps = WithPolicyAndFullscreenLoadingProps & WithNavigationTransitionEndProps & StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.INVITE>;

/** An object containing the accountID for every invited user email */
invitedEmailsToAccountIDsDraft: OnyxEntry<InvitedEmailsToAccountIDs>;
};

type WorkspaceInvitePageProps = WithPolicyAndFullscreenLoadingProps &
WithNavigationTransitionEndProps &
WorkspaceInvitePageOnyxProps &
StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.INVITE>;

function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, policy}: WorkspaceInvitePageProps) {
function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const navigation = useNavigation();
Expand All @@ -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);
Expand Down Expand Up @@ -357,15 +348,4 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli

WorkspaceInvitePage.displayName = 'WorkspaceInvitePage';

export default withNavigationTransitionEnd(
withPolicyAndFullscreenLoading(
withOnyx<WorkspaceInvitePageProps, WorkspaceInvitePageOnyxProps>({
betas: {
key: ONYXKEYS.BETAS,
},
invitedEmailsToAccountIDsDraft: {
key: ({route}) => `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${route.params.policyID.toString()}`,
},
})(WorkspaceInvitePage),
),
);
export default withNavigationTransitionEnd(withPolicyAndFullscreenLoading(WorkspaceInvitePage));

0 comments on commit fbc8be1

Please sign in to comment.