Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: environment section being broken
Andrew Bastin4a0205e62242
diff --git a/packages/hoppscotch-common/src/components.d.ts b/packages/hoppscotch-common/src/components.d.tsindex 3fd4938e9..2b286a43b 100644--- a/packages/hoppscotch-common/src/components.d.ts+++ b/packages/hoppscotch-common/src/components.d.ts@@ -131,7 +131,6 @@ declare module '@vue/runtime-core' {IconLucideListEnd: typeof import('~icons/lucide/list-end')['default']IconLucideMinus: typeof import('~icons/lucide/minus')['default']IconLucideSearch: typeof import('~icons/lucide/search')['default']- IconLucideUser: typeof import('~icons/lucide/user')['default']IconLucideUsers: typeof import('~icons/lucide/users')['default']LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']@@ -142,7 +141,6 @@ declare module '@vue/runtime-core' {LensesRenderersRawLensRenderer: typeof import('./components/lenses/renderers/RawLensRenderer.vue')['default']LensesRenderersXMLLensRenderer: typeof import('./components/lenses/renderers/XMLLensRenderer.vue')['default']LensesResponseBodyRenderer: typeof import('./components/lenses/ResponseBodyRenderer.vue')['default']- ProfilePicture: typeof import('./components/profile/Picture.vue')['default']ProfileShortcode: typeof import('./components/profile/Shortcode.vue')['default']ProfileShortcodes: typeof import('./components/profile/Shortcodes.vue')['default']ProfileUserDelete: typeof import('./components/profile/UserDelete.vue')['default']diff --git a/packages/hoppscotch-common/src/components/environments/Selector.vue b/packages/hoppscotch-common/src/components/environments/Selector.vueindex b62f4c207..0d67ce7d0 100644--- a/packages/hoppscotch-common/src/components/environments/Selector.vue+++ b/packages/hoppscotch-common/src/components/environments/Selector.vue@@ -36,13 +36,12 @@? IconCheck: undefined"- class="my-2":active-info-icon="selectedEnvironmentIndex.type === 'NO_ENV_SELECTED'"@click="() => {- setSelectedEnvironmentIndex({ type: 'NO_ENV_SELECTED' })+ selectedEnvironmentIndex = { type: 'NO_ENV_SELECTED' }hide()}"diff --git a/packages/hoppscotch-common/src/components/environments/index.vue b/packages/hoppscotch-common/src/components/environments/index.vueindex bdd8cce96..2232a5dcd 100644--- a/packages/hoppscotch-common/src/components/environments/index.vue+++ b/packages/hoppscotch-common/src/components/environments/index.vue@@ -121,7 +121,7 @@ const switchToMyEnvironments = () => {adapter.changeTeamID(undefined)}-const updateSelectedTeam = (newSelectedTeam: SelectedTeam) => {+const updateSelectedTeam = (newSelectedTeam: SelectedTeam | undefined) => {if (newSelectedTeam) {environmentType.value.selectedTeam = newSelectedTeamREMEMBERED_TEAM_ID.value = newSelectedTeam.id@@ -150,25 +150,27 @@ const workspace = useReadonlyStream(workspaceStatus$, { type: "personal" })// Used to switch environment type and team when user switch workspace in the global workspace switcher// Check if there is a teamID in the workspace, if yes, switch to team environment and select the team// If there is no teamID, switch to my environment-watch(- () => workspace.value.type === "team" && workspace.value.teamID,- (teamID) => {- if (!teamID) {+watch(workspace, (newWorkspace, oldWorkspace) => {+ // If we are switching into personal from outside+ if (newWorkspace.type === "personal" && oldWorkspace.type !== "personal") {+ // If the selected environment is not a my environment, turn off the env+ if (selectedEnvironmentIndex.value.type !== "MY_ENV") {switchToMyEnvironments()setSelectedEnvironmentIndex({type: "NO_ENV_SELECTED",})- } else {- const team = myTeams.value?.find((t) => t.id === teamID)- if (team) {- updateSelectedTeam(team)- setSelectedEnvironmentIndex({- type: "NO_ENV_SELECTED",- })- }+ }+ } else if (newWorkspace.type === "team") {+ const team = myTeams.value?.find((t) => t.id === newWorkspace.teamID)+ updateSelectedTeam(team)++ if (selectedEnvironmentIndex.value.type !== "MY_ENV") {+ setSelectedEnvironmentIndex({+ type: "NO_ENV_SELECTED",+ })}}-)+})watch(() => currentUser.value,diff --git a/packages/hoppscotch-common/src/newstore/environments.ts b/packages/hoppscotch-common/src/newstore/environments.tsindex 326788f8e..ed77728a2 100644--- a/packages/hoppscotch-common/src/newstore/environments.ts+++ b/packages/hoppscotch-common/src/newstore/environments.ts@@ -42,16 +42,21 @@ const dispatchers = defineDispatchers({selectedEnvironmentIndex,}: { selectedEnvironmentIndex: SelectedEnvironmentIndex }) {- if (- selectedEnvironmentIndex.type === "MY_ENV" &&- !!store.environments[selectedEnvironmentIndex.index]- ) {- return {- selectedEnvironmentIndex,+ if (selectedEnvironmentIndex.type === "MY_ENV") {+ if (store.environments[selectedEnvironmentIndex.index]) {+ return {+ selectedEnvironmentIndex,+ }+ } else {+ return {+ selectedEnvironmentIndex: {+ type: "NO_ENV_SELECTED",+ },+ }}} else {return {- type: "NO_ENV_SELECTED",+ selectedEnvironmentIndex,}}},