diff --git a/lib/src/Components/Onboarding/InvitePage.tsx b/lib/src/Components/Onboarding/InvitePage.tsx index b7bc06ea..3c0246d8 100644 --- a/lib/src/Components/Onboarding/InvitePage.tsx +++ b/lib/src/Components/Onboarding/InvitePage.tsx @@ -98,6 +98,13 @@ export function InvitePage({ inviteApi, itemsApi }: Props) { const invitingProfile = await itemsApi.getItem(invitingProfileId) + if (!invitingProfile) { + toast.error('Inviting profile not found') + localStorage.removeItem('inviteCode') + void navigate('/') + return + } + if (invitingProfileId === myProfile?.id) { toast.error('You cannot invite yourself') localStorage.removeItem('inviteCode') @@ -117,13 +124,6 @@ export function InvitePage({ inviteApi, itemsApi }: Props) { return } - if (!invitingProfile) { - toast.error('Inviting profile not found') - localStorage.removeItem('inviteCode') - void navigate('/') - return - } - setInvitingProfile(invitingProfile) }