Fix profile flashing on reload

This commit is contained in:
Bill 2022-03-23 02:05:30 -04:00
parent b9f4ee425e
commit ebaecde1dc

View File

@ -56,12 +56,23 @@ export const UserProfileView: FC<{}> = props =>
const onUserProfileEvent = useCallback((event: UserProfileEvent) => const onUserProfileEvent = useCallback((event: UserProfileEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
let isSameProfile = false;
BatchUpdates(() => BatchUpdates(() =>
{ {
setUserProfile(parser); setUserProfile(prevValue =>
setUserBadges([]); {
setUserRelationships(null); isSameProfile = (prevValue.id === parser.id);
return parser;
});
if(!isSameProfile)
{
setUserBadges([]);
setUserRelationships(null);
}
}); });
SendMessageComposer(new UserCurrentBadgesComposer(parser.id)); SendMessageComposer(new UserCurrentBadgesComposer(parser.id));