@@ -26,7 +26,6 @@ import {
2626 usePersonalEnvironment ,
2727 useSavePersonalEnvironment ,
2828 useUpsertWorkspaceEnvironment ,
29- useWorkspaceEnvironment ,
3029} from '@/hooks/queries/environment'
3130import { useKnowledgeBasesQuery } from '@/hooks/queries/kb/knowledge'
3231import { useTablesList } from '@/hooks/queries/tables'
@@ -671,21 +670,12 @@ function SecretInputDisplay({ data }: { data: CredentialTagData }) {
671670 const upsertWorkspace = useUpsertWorkspaceEnvironment ( )
672671 const savePersonal = useSavePersonalEnvironment ( )
673672 const { data : personalEnv } = usePersonalEnvironment ( )
674- const { data : workspaceEnv } = useWorkspaceEnvironment ( workspaceId )
675673 const { canEdit } = useUserPermissionsContext ( )
676674
677675 // Setting a workspace var needs write/admin (same gate as the secrets manager);
678676 // personal vars are the user's own, so any member may set them.
679677 const canManage = scope === 'personal' || canEdit
680678
681- // Reflect persisted state so the widget still shows "saved" after navigating
682- // away and back (local `saved` is lost on remount). Key presence is enough —
683- // workspace values come back masked for non-admins.
684- const alreadySaved =
685- scope === 'personal'
686- ? personalEnv !== undefined && secretName in personalEnv
687- : workspaceEnv !== undefined && secretName in workspaceEnv . workspace
688-
689679 const isSaving = upsertWorkspace . isPending || savePersonal . isPending
690680 // Personal saves replace the whole map, so block until existing vars are loaded.
691681 const personalReady = scope !== 'personal' || personalEnv !== undefined
@@ -712,9 +702,9 @@ function SecretInputDisplay({ data }: { data: CredentialTagData }) {
712702 }
713703
714704 if ( ! secretName ) return null
715- // Already-set keys show a read-only "saved" indicator for everyone; the editable
716- // input only renders for users who can actually set the key.
717- if ( saved || alreadySaved ) return < SecretReveal redacted />
705+ // Only confirm after the user saves via THIS widget. A fresh prompt always shows
706+ // the input so the user can set or override the key, even if it already exists .
707+ if ( saved ) return < SecretReveal redacted />
718708 if ( ! canManage ) return null
719709
720710 return (
0 commit comments