From 1ca6ed5d6c23d17835a5f02b21915a8d598b20bb Mon Sep 17 00:00:00 2001 From: Vadym Pavlyk Date: Wed, 20 Nov 2024 23:57:58 +0200 Subject: [PATCH] Fixed changing a user photo in the header --- src/containers/navigation-icons/AccountIcon.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/containers/navigation-icons/AccountIcon.tsx b/src/containers/navigation-icons/AccountIcon.tsx index cfe35568b..718d91854 100644 --- a/src/containers/navigation-icons/AccountIcon.tsx +++ b/src/containers/navigation-icons/AccountIcon.tsx @@ -1,4 +1,4 @@ -import { useCallback, FC, MouseEvent } from 'react' +import { useMemo, useCallback, FC, MouseEvent } from 'react' import { useTranslation } from 'react-i18next' import { useAppSelector } from '~/hooks/use-redux' import { AxiosResponse } from 'axios' @@ -39,7 +39,7 @@ const AccountIcon: FC = ({ openMenu }) => { const { photo: statePhoto } = useAppSelector((state) => state.editProfile) - const getAvatarSrc = useCallback(() => { + const avatarSrc = useMemo(() => { if (statePhoto?.src) { return statePhoto.src } @@ -49,8 +49,6 @@ const AccountIcon: FC = ({ openMenu }) => { } }, [photo, statePhoto]) - const avatarSrc = getAvatarSrc() - if (loading) { return }