fix(fe): setActiveWorkspaceMutation - check workspace FF and early return if false

fix(fe): setActiveWorkspaceMutation - check workspace FF and early return if false
This commit is contained in:
andrewwallacespeckle
2025-05-29 14:31:49 +02:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
@@ -14,6 +14,7 @@ export const useNavigation = () => {
const state = useNavigationState()
const { mutate } = useMutation(setActiveWorkspaceMutation)
const { $intercom } = useNuxtApp()
const isWorkspacesEnabled = useIsWorkspacesEnabled()
const activeWorkspaceSlug = computed({
get: () => state.value.activeWorkspaceSlug,
@@ -28,6 +29,8 @@ export const useNavigation = () => {
const mutateActiveWorkspaceSlug = async (newVal: string | null) => {
state.value.activeWorkspaceSlug = newVal
state.value.isProjectsActive = false
if (!isWorkspacesEnabled.value) return
await mutate({ slug: newVal, isProjectsActive: false })
$intercom.updateCompany()
}
@@ -35,6 +38,8 @@ export const useNavigation = () => {
const mutateIsProjectsActive = async (isActive: boolean) => {
state.value.isProjectsActive = isActive
state.value.activeWorkspaceSlug = null
if (!isWorkspacesEnabled.value) return
await mutate({ isProjectsActive: state.value.isProjectsActive, slug: null })
}
@@ -24,6 +24,11 @@ export = !FF_WORKSPACES_MODULE_ENABLED
Mutation: {
workspaceMutations: () => ({})
},
ActiveUserMutations: {
setActiveWorkspace: async () => {
throw new WorkspacesModuleDisabledError()
}
},
WorkspaceMutations: {
create: async () => {
throw new WorkspacesModuleDisabledError()