Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: add optional chaining for teamMembers to handle undefined team (#3484)

Nicolas Merget5428a738117b
diff --git a/packages/hoppscotch-common/src/components/teams/Edit.vue b/packages/hoppscotch-common/src/components/teams/Edit.vue
index 90fc88656..28129a90b 100644
--- a/packages/hoppscotch-common/src/components/teams/Edit.vue
+++ b/packages/hoppscotch-common/src/components/teams/Edit.vue
@@ -35,12 +35,12 @@
v-if="
!teamDetails.loading &&
E.isRight(teamDetails.data) &&
- teamDetails.data.right.team.teamMembers
+ teamDetails.data.right.team?.teamMembers
"
class="border rounded border-divider"
>
<HoppSmartPlaceholder
- v-if="teamDetails.data.right.team.teamMembers === 0"
+ v-if="teamDetails.data.right.team.teamMembers.length === 0"
:src="`/images/states/${colorMode.value}/add_group.svg`"
:alt="`${t('empty.members')}`"
:text="t('empty.members')"
diff --git a/packages/hoppscotch-common/src/components/teams/Invite.vue b/packages/hoppscotch-common/src/components/teams/Invite.vue
index 9fa38002a..94c3fe8f1 100644
--- a/packages/hoppscotch-common/src/components/teams/Invite.vue
+++ b/packages/hoppscotch-common/src/components/teams/Invite.vue
@@ -88,7 +88,7 @@
>
<div
v-for="(invitee, index) in pendingInvites.data.right.team
- .teamInvitations"
+ ?.teamInvitations"
:key="`invitee-${index}`"
class="flex divide-x divide-dividerLight"
>
@@ -122,7 +122,7 @@
<HoppSmartPlaceholder
v-if="
E.isRight(pendingInvites.data) &&
- pendingInvites.data.right.team.teamInvitations.length === 0
+ pendingInvites.data.right.team?.teamInvitations.length === 0
"
:text="t('empty.pending_invites')"
>