diff --git a/ts/components/dialog/edit-profile/EditProfileDialog.tsx b/ts/components/dialog/edit-profile/EditProfileDialog.tsx index b4ffdf7d9..d679b672f 100644 --- a/ts/components/dialog/edit-profile/EditProfileDialog.tsx +++ b/ts/components/dialog/edit-profile/EditProfileDialog.tsx @@ -216,6 +216,7 @@ export const EditProfileDialog = () => { setLoading(true); const validName = await ProfileManager.updateOurProfileDisplayName(profileName); setUpdateProfileName(validName); + setProfileName(validName); setMode('default'); } catch (err) { window.log.error('Profile update error', err); diff --git a/ts/components/registration/utils/index.tsx b/ts/components/registration/utils/index.tsx index 3ea00dfc6..4220c06d2 100644 --- a/ts/components/registration/utils/index.tsx +++ b/ts/components/registration/utils/index.tsx @@ -9,15 +9,14 @@ export function sanitizeDisplayNameOrToast( ) { try { const sanitizedName = sanitizeSessionUsername(displayName); - const trimName = sanitizedName.trim(); - const errorString = !trimName ? window.i18n('displayNameEmpty') : undefined; + const errorString = !sanitizedName ? window.i18n('displayNameEmpty') : undefined; if (dispatch) { dispatch(onDisplayNameError(errorString)); } else { onDisplayNameError(errorString); // this is is either calling dispatch in the caller or just `setDisplayNameError` } - return trimName; + return sanitizedName; } catch (e) { if (dispatch) { dispatch(onDisplayNameError(window.i18n('displayNameErrorDescriptionShorter')));