mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Fix profile flashing on reload
This commit is contained in:
parent
b9f4ee425e
commit
ebaecde1dc
@ -56,12 +56,23 @@ export const UserProfileView: FC<{}> = props =>
|
||||
const onUserProfileEvent = useCallback((event: UserProfileEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
let isSameProfile = false;
|
||||
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setUserProfile(parser);
|
||||
setUserBadges([]);
|
||||
setUserRelationships(null);
|
||||
setUserProfile(prevValue =>
|
||||
{
|
||||
isSameProfile = (prevValue.id === parser.id);
|
||||
|
||||
return parser;
|
||||
});
|
||||
|
||||
if(!isSameProfile)
|
||||
{
|
||||
setUserBadges([]);
|
||||
setUserRelationships(null);
|
||||
}
|
||||
});
|
||||
|
||||
SendMessageComposer(new UserCurrentBadgesComposer(parser.id));
|
||||
|
Loading…
x
Reference in New Issue
Block a user