diff --git a/.changeset/beige-zebras-walk.md b/.changeset/beige-zebras-walk.md new file mode 100644 index 0000000000..26ad52dc1d --- /dev/null +++ b/.changeset/beige-zebras-walk.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-user-settings': patch +--- + +Reflect the updated sign on status for a provider after signing out. diff --git a/plugins/user-settings/src/components/AuthProviders/ProviderSettingsItem.tsx b/plugins/user-settings/src/components/AuthProviders/ProviderSettingsItem.tsx index 852af7e78b..e3fb597a15 100644 --- a/plugins/user-settings/src/components/AuthProviders/ProviderSettingsItem.tsx +++ b/plugins/user-settings/src/components/AuthProviders/ProviderSettingsItem.tsx @@ -37,6 +37,8 @@ import { } from '@backstage/core-plugin-api'; import { ProviderSettingsAvatar } from './ProviderSettingsAvatar'; +const emptyProfile: ProfileInfo = {}; + /** @public */ export const ProviderSettingsItem = (props: { title: string; @@ -49,8 +51,7 @@ export const ProviderSettingsItem = (props: { const api = useApi(apiRef); const errorApi = useApi(errorApiRef); const [signedIn, setSignedIn] = useState(false); - const emptyProfile: ProfileInfo = {}; - const [profile, setProfile] = useState(emptyProfile); + const [profile, setProfile] = useState(emptyProfile); useEffect(() => { let didCancel = false; @@ -58,6 +59,10 @@ export const ProviderSettingsItem = (props: { const subscription = api .sessionState$() .subscribe((sessionState: SessionState) => { + if (sessionState !== SessionState.SignedIn) { + setProfile(emptyProfile); + setSignedIn(false); + } if (!didCancel) { api .getProfile({ optional: true })