diff --git a/.changeset/green-icons-smash.md b/.changeset/green-icons-smash.md
new file mode 100644
index 0000000000000000000000000000000000000000..5419c2c3fa5b22bed106a2332ab8a163dc806a1c
--- /dev/null
+++ b/.changeset/green-icons-smash.md
@@ -0,0 +1,5 @@
+---
+"@rocket.chat/meteor": patch
+---
+
+fix: Avatar is reset in the UI when username is changed
diff --git a/apps/meteor/app/lib/server/functions/saveUserIdentity.ts b/apps/meteor/app/lib/server/functions/saveUserIdentity.ts
index a7c9866478520688b9b8676365c97ef39c0e58b0..37ec3a890bd36173ce79447e0b1260c9aa67640c 100644
--- a/apps/meteor/app/lib/server/functions/saveUserIdentity.ts
+++ b/apps/meteor/app/lib/server/functions/saveUserIdentity.ts
@@ -49,6 +49,16 @@ export async function saveUserIdentity({ _id, name: rawName, username: rawUserna
 	// if coming from old username, update all references
 	if (previousUsername) {
 		if (usernameChanged && typeof rawUsername !== 'undefined') {
+			const fileStore = FileUpload.getStore('Avatars');
+			const previousFile = await fileStore.model.findOneByName(previousUsername);
+			const file = await fileStore.model.findOneByName(username);
+			if (file) {
+				await fileStore.model.deleteFile(file._id);
+			}
+			if (previousFile) {
+				await fileStore.model.updateFileNameById(previousFile._id, username);
+			}
+
 			await Messages.updateAllUsernamesByUserId(user._id, username);
 			await Messages.updateUsernameOfEditByUserId(user._id, username);
 
@@ -64,16 +74,6 @@ export async function saveUserIdentity({ _id, name: rawName, username: rawUserna
 			await Subscriptions.setUserUsernameByUserId(user._id, username);
 
 			await LivechatDepartmentAgents.replaceUsernameOfAgentByUserId(user._id, username);
-
-			const fileStore = FileUpload.getStore('Avatars');
-			const previousFile = await fileStore.model.findOneByName(previousUsername);
-			const file = await fileStore.model.findOneByName(username);
-			if (file) {
-				await fileStore.model.deleteFile(file._id);
-			}
-			if (previousFile) {
-				await fileStore.model.updateFileNameById(previousFile._id, username);
-			}
 		}
 
 		// update other references if either the name or username has changed