diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.ts index 4974d069b..0f3047587 100644 --- a/packages/hoppscotch-common/src/components.d.ts +++ b/packages/hoppscotch-common/src/components.d.ts @@ -116,7 +116,6 @@ declare module '@vue/runtime-core' { HttpTests: typeof import('./components/http/Tests.vue')['default'] HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default'] IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default'] - IconLucideBrush: typeof import('~icons/lucide/brush')['default'] IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default'] IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default'] IconLucideGlobe: typeof import('~icons/lucide/globe')['default'] @@ -125,7 +124,6 @@ declare module '@vue/runtime-core' { IconLucideInfo: typeof import('~icons/lucide/info')['default'] IconLucideLayers: typeof import('~icons/lucide/layers')['default'] IconLucideMinus: typeof import('~icons/lucide/minus')['default'] - IconLucideRss: typeof import('~icons/lucide/rss')['default'] IconLucideSearch: typeof import('~icons/lucide/search')['default'] IconLucideUser: typeof import('~icons/lucide/user')['default'] IconLucideUsers: typeof import('~icons/lucide/users')['default'] diff --git a/packages/hoppscotch-common/src/components/environments/index.vue b/packages/hoppscotch-common/src/components/environments/index.vue index f868390b5..22016ce71 100644 --- a/packages/hoppscotch-common/src/components/environments/index.vue +++ b/packages/hoppscotch-common/src/components/environments/index.vue @@ -255,15 +255,6 @@ watch( } ) -watch( - () => environmentType.value.selectedTeam, - (newTeam) => { - if (newTeam) { - adapter.changeTeamID(newTeam.id) - } - } -) - const switchToMyEnvironments = () => { environmentType.value.selectedTeam = undefined updateEnvironmentType("my-environments") @@ -282,17 +273,10 @@ const updateEnvironmentType = (newEnvironmentType: EnvironmentType) => { } watch( - () => environmentType.value.selectedTeam?.id, - (newTeamID) => { - adapter.changeTeamID(newTeamID) - } -) - -watch( - () => currentUser.value, - (newValue) => { - if (!newValue) { - switchToMyEnvironments() + () => environmentType.value.selectedTeam, + (newTeam) => { + if (newTeam) { + adapter.changeTeamID(newTeam.id) } } ) @@ -320,6 +304,15 @@ watch( } ) +watch( + () => currentUser.value, + (newValue) => { + if (!newValue) { + switchToMyEnvironments() + } + } +) + const showModalDetails = ref(false) const action = ref<"new" | "edit">("edit") const editingEnvironmentIndex = ref<"Global" | null>(null) diff --git a/packages/hoppscotch-common/src/components/environments/teams/index.vue b/packages/hoppscotch-common/src/components/environments/teams/index.vue index 3d281c408..45d46a568 100644 --- a/packages/hoppscotch-common/src/components/environments/teams/index.vue +++ b/packages/hoppscotch-common/src/components/environments/teams/index.vue @@ -125,14 +125,14 @@ import { useColorMode } from "~/composables/theming" import IconPlus from "~icons/lucide/plus" import IconArchive from "~icons/lucide/archive" import IconHelpCircle from "~icons/lucide/help-circle" -import { Team } from "~/helpers/backend/graphql" import { defineActionHandler } from "~/helpers/actions" +import { GetMyTeamsQuery } from "~/helpers/backend/graphql" const t = useI18n() const colorMode = useColorMode() -type SelectedTeam = Team | undefined +type SelectedTeam = GetMyTeamsQuery["myTeams"][number] | undefined const props = defineProps<{ team: SelectedTeam diff --git a/packages/hoppscotch-common/src/helpers/teams/TeamEnvironmentAdapter.ts b/packages/hoppscotch-common/src/helpers/teams/TeamEnvironmentAdapter.ts index 7ed676625..90a0966b4 100644 --- a/packages/hoppscotch-common/src/helpers/teams/TeamEnvironmentAdapter.ts +++ b/packages/hoppscotch-common/src/helpers/teams/TeamEnvironmentAdapter.ts @@ -45,6 +45,7 @@ export default class TeamEnvironmentAdapter { this.teamEnvironmentCreated$ = null this.teamEnvironmentDeleted$ = null this.teamEnvironmentUpdated$ = null + this.teamEnvironmentCreatedSub = null this.teamEnvironmentDeletedSub = null this.teamEnvironmentUpdatedSub = null @@ -56,6 +57,7 @@ export default class TeamEnvironmentAdapter { this.teamEnvironmentCreated$?.unsubscribe() this.teamEnvironmentDeleted$?.unsubscribe() this.teamEnvironmentUpdated$?.unsubscribe() + this.teamEnvironmentCreatedSub?.unsubscribe() this.teamEnvironmentDeletedSub?.unsubscribe() this.teamEnvironmentUpdatedSub?.unsubscribe()