diff --git a/src/components/UserProfileAvatar.jsx b/src/components/UserProfileAvatar.jsx index 0cfd165..e306c99 100644 --- a/src/components/UserProfileAvatar.jsx +++ b/src/components/UserProfileAvatar.jsx @@ -32,7 +32,7 @@ import { useImpersonateUser } from '../contexts/ImpersonateUserContext' import useStickyState from '../hooks/useStickyState' import { useCircleMembers, useUserProfile } from '../queries/UserQueries' import { apiClient } from '../utils/ApiClient' -import { isPlusAccount } from '../utils/Helpers' +import { isPlusAccount, resolvePhotoURL } from '../utils/Helpers' import UserModal from '../views/Modals/Inputs/UserModal' import SubscriptionModal from './SubscriptionModal' @@ -116,7 +116,7 @@ const UserProfileAvatar = () => { {isImpersonating ? ( { }} /> { ) : ( { { const { t } = useTranslation('settings') const queryClient = useQueryClient() - const { data: userProfile } = useUserProfile() + const { data: userProfile, refetch: refetchUserProfile } = useUserProfile() const { showSuccess, showError } = useNotification() const [displayName, setDisplayName] = useState(userProfile?.displayName || '') const [timezone, setTimezone] = useState( userProfile?.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone, ) - const [photoURL, setPhotoURL] = useState(userProfile?.image || '') const [isUploading, setIsUploading] = useState(false) const [isSaving, setIsSaving] = useState(false) const fileInputRef = useRef() @@ -90,9 +89,9 @@ const ProfileSettings = () => { const response = await apiClient.upload('/users/profile_photo', formData) if (!response.ok) throw new Error('Upload failed') const data = await response.json() - const url = resolvePhotoURL(data.url || data.sign) + // const url = resolvePhotoURL(data.url || data.sign) - setPhotoURL(url) + refetchUserProfile() // Refresh user profile to get the new photoURL showSuccess({ title: t('profile.photoUpdated'), message: t('profile.photoUpdatedMessage'), @@ -155,7 +154,7 @@ const ProfileSettings = () => { maxWidth: 400, }} > - +