diff --git a/packages/hoppscotch-common/src/components/environments/Selector.vue b/packages/hoppscotch-common/src/components/environments/Selector.vue index 955e9af2fd..604c1344e9 100644 --- a/packages/hoppscotch-common/src/components/environments/Selector.vue +++ b/packages/hoppscotch-common/src/components/environments/Selector.vue @@ -97,7 +97,7 @@ {{ t("state.loading") }} -
+
{ + !teamListAdapter.isInitialized && teamListAdapter.initialize() +}) + +const switchToTeamWorkspace = (team: GetMyTeamsQuery["myTeams"][number]) => { + REMEMBERED_TEAM_ID.value = team.id + changeWorkspace({ + teamID: team.id, + teamName: team.name, + type: "team", + }) +} + +watch( + () => myTeams.value, + (newTeams) => { + if (newTeams && !teamListFetched.value) { + teamListFetched.value = true + if (REMEMBERED_TEAM_ID.value) { + const team = newTeams.find((t) => t.id === REMEMBERED_TEAM_ID.value) + if (team) switchToTeamWorkspace(team) + } + } + } +) + const selectedEnv = computed(() => { if (selectedEnvironmentIndex.value.type === "MY_ENV") { return {