Feat/workspaces 5 auth gate check (#8350)

## Summary

- Fix auth related race conditions with a new WorkspaceAuthGate in
App.vue
- De dup initialization calls 
- Add state machine to track state of refreshRemoteConfig
- Fix websocket not using new workspace jwt
- Misc improvments

## Changes

- **What**: Mainly WorkspaceAuthGate.vue
- **Breaking**: <!-- Any breaking changes (if none, remove this line)
-->
- **Dependencies**: <!-- New dependencies (if none, remove this line)
-->

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8350-Feat-workspaces-5-auth-gate-check-2f66d73d365081b1a49afcd418fab3e7)
by [Unito](https://www.unito.io)
This commit is contained in:
Simula_r
2026-01-27 20:28:44 -08:00
committed by GitHub
parent d890e7568a
commit 34fc28a39d
12 changed files with 428 additions and 51 deletions

View File

@@ -52,7 +52,6 @@ import { useProgressFavicon } from '@/composables/useProgressFavicon'
import { SERVER_CONFIG_ITEMS } from '@/constants/serverConfig'
import { i18n, loadLocale } from '@/i18n'
import ModelImportProgressDialog from '@/platform/assets/components/ModelImportProgressDialog.vue'
import { useFeatureFlags } from '@/composables/useFeatureFlags'
import { isCloud } from '@/platform/distribution/types'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useTelemetry } from '@/platform/telemetry'
@@ -246,27 +245,6 @@ const onReconnected = () => {
}
}
// Initialize workspace store when feature flag and auth become available
// Uses watch because remoteConfig loads asynchronously after component mount
if (isCloud) {
const { flags } = useFeatureFlags()
watch(
() => [flags.teamWorkspacesEnabled, firebaseAuthStore.isAuthenticated],
async ([enabled, isAuthenticated]) => {
if (!enabled || !isAuthenticated) return
const { useTeamWorkspaceStore } =
await import('@/platform/workspace/stores/teamWorkspaceStore')
const workspaceStore = useTeamWorkspaceStore()
if (workspaceStore.initState === 'uninitialized') {
await workspaceStore.initialize()
}
},
{ immediate: true }
)
}
useEventListener(api, 'status', onStatus)
useEventListener(api, 'execution_success', onExecutionSuccess)
useEventListener(api, 'reconnecting', onReconnecting)