From 1a81c44162ce99bc88a315edd95060ffa3c21291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jerna=C5=9B?= Date: Thu, 3 Oct 2024 12:45:05 +0200 Subject: [PATCH] Don't mutate retrieved identityProfile, replace it instead. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Łukasz Jernaś --- plugins/user-settings/src/components/useUserProfileInfo.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/user-settings/src/components/useUserProfileInfo.ts b/plugins/user-settings/src/components/useUserProfileInfo.ts index f777c3d75b..e368b9e688 100644 --- a/plugins/user-settings/src/components/useUserProfileInfo.ts +++ b/plugins/user-settings/src/components/useUserProfileInfo.ts @@ -32,7 +32,7 @@ export const useUserProfile = () => { const catalogApi = useApi(catalogApiRef); const { value, loading, error } = useAsync(async () => { - const identityProfile = await identityApi.getProfileInfo(); + let identityProfile = await identityApi.getProfileInfo(); const backStageIdentity = await identityApi.getBackstageIdentity(); const catalogProfile = (await catalogApi.getEntityByRef( backStageIdentity.userEntityRef, @@ -41,7 +41,10 @@ export const useUserProfile = () => { identityProfile.picture === undefined && catalogProfile?.spec?.profile?.picture ) { - identityProfile.picture = catalogProfile.spec.profile.picture; + identityProfile = { + ...identityProfile, + picture: catalogProfile.spec.profile.picture, + }; } return { profile: identityProfile,