fix: reset currentEnv if there is a shared workspace change (#4255)
* fix: reset currentEnv if there is a shared workspace change * chore: cleanup --------- Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
@@ -139,16 +139,27 @@ const workspace = workspaceService.currentWorkspace
|
|||||||
// Switch to my environments if workspace is personal and to team environments if workspace is team
|
// Switch to my environments if workspace is personal and to team environments if workspace is team
|
||||||
// also resets selected environment if workspace is personal and the previous selected environment was a team environment
|
// also resets selected environment if workspace is personal and the previous selected environment was a team environment
|
||||||
watch(workspace, (newWorkspace) => {
|
watch(workspace, (newWorkspace) => {
|
||||||
if (newWorkspace.type === "personal") {
|
const { type: newWorkspaceType } = newWorkspace
|
||||||
|
|
||||||
|
if (newWorkspaceType === "personal") {
|
||||||
switchToMyEnvironments()
|
switchToMyEnvironments()
|
||||||
if (selectedEnvironmentIndex.value.type !== "MY_ENV") {
|
} else {
|
||||||
setSelectedEnvironmentIndex({
|
|
||||||
type: "NO_ENV_SELECTED",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (newWorkspace.type === "team") {
|
|
||||||
updateSelectedTeam(newWorkspace)
|
updateSelectedTeam(newWorkspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const newTeamID =
|
||||||
|
newWorkspaceType === "team" ? newWorkspace.teamID : undefined
|
||||||
|
|
||||||
|
// Set active environment to the `No environment` state
|
||||||
|
// if navigating away from a team workspace
|
||||||
|
if (
|
||||||
|
selectedEnvironmentIndex.value.type === "TEAM_ENV" &&
|
||||||
|
selectedEnvironmentIndex.value.teamID !== newTeamID
|
||||||
|
) {
|
||||||
|
setSelectedEnvironmentIndex({
|
||||||
|
type: "NO_ENV_SELECTED",
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Service } from "dioc"
|
import { Service } from "dioc"
|
||||||
import { reactive } from "vue"
|
import { reactive, computed } from "vue"
|
||||||
import { computed } from "vue"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a secret environment variable.
|
* Defines a secret environment variable.
|
||||||
|
|||||||
Reference in New Issue
Block a user