diff --git a/src/pages/views/teamsbot/TeamsbotDashboardView.tsx b/src/pages/views/teamsbot/TeamsbotDashboardView.tsx index acabf68..ba5fb32 100644 --- a/src/pages/views/teamsbot/TeamsbotDashboardView.tsx +++ b/src/pages/views/teamsbot/TeamsbotDashboardView.tsx @@ -127,8 +127,10 @@ export const TeamsbotDashboardView: React.FC = () => { return; } - // userAccount with new credentials: always save to DB (backend loads from there) - if (joinMode === 'userAccount' && showCredentialForm && credEmail && credPassword) { + // userAccount with new/unsaved credentials: save to DB before starting + const needsSave = joinMode === 'userAccount' && !userAccount?.hasSavedCredentials && credEmail && credPassword; + const needsUpdate = joinMode === 'userAccount' && showCredentialForm && credEmail && credPassword; + if (needsSave || needsUpdate) { try { setSavingCredentials(true); await teamsbotApi.saveUserAccount(instanceId, credEmail, credPassword);