Skip to content

fix: avoid avatar update when opening profile - #6490

Open
almacbe wants to merge 1 commit into
inovex:mainfrom
almacbe:am/fix-profile-avatar-request
Open

fix: avoid avatar update when opening profile#6490
almacbe wants to merge 1 commit into
inovex:mainfrom
almacbe:am/fix-profile-avatar-request

Conversation

@almacbe

@almacbe almacbe commented Aug 11, 2026

Copy link
Copy Markdown

Description

Fixes #5577

AvatarSettings treated its initial effect as a user change and persisted the current avatar whenever the profile opened. It now dispatches editSelf only when the local avatar is semantically different from the persisted avatar.

This keeps the intentional migration for older avatars without backgroundColor, because the completed avatar still differs from the stored value and is persisted once. Regression tests cover initial mounting, real and duplicate shuffle results, optimistic updates, legacy avatars, and missing avatars.

Changelog

  • Skip avatar updates when the local and persisted avatar values are deeply equal.
  • Keep optimistic persistence for real avatar changes and legacy avatar migration.
  • Add behavioral coverage around the API.editUser boundary.

Checklist

  • I have performed a self-review of my own code
  • I have written and understand every part of this contribution myself - if AI tools were used, I have thoroughly reviewed and verified all changes
  • I have commented my code, particularly in hard-to-understand areas
  • The light- and dark-theme are both supported and tested
  • The design was implemented and is responsive for all devices and screen sizes
  • The application was tested in the most commonly used browsers (e.g. Chrome, Firefox, Safari)

(Optional) Visual Changes

None. This change does not alter the UI.

@almacbe
almacbe marked this pull request as ready for review August 13, 2026 07:12
@Planlos5000 Planlos5000 added Review Needed This pull request is ready for review feat This pull request or issue adds a new feature labels Aug 13, 2026
const migratedAvatar = {...oldAvatar, backgroundColor: completeAvatar.backgroundColor};
expect(API.editUser).toHaveBeenCalledWith({...auth, avatar: migratedAvatar});
expect(store.getState().auth.user?.avatar).toEqual(migratedAvatar);
expect(API.editUser).toHaveBeenCalledTimes(1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the duplicate toHaveBeenCalled check necessary?

@Schwehn42 Schwehn42 removed the Review Needed This pull request is ready for review label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat This pull request or issue adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP request when opening profile

3 participants