mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-09 13:51:57 -04:00
fix(async-loading): show async loaded components only if value is present
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
26c1f1bcaa
commit
caf212045a
11 changed files with 13 additions and 16 deletions
|
@ -38,13 +38,9 @@ export const UserAvatarForUsername: React.FC<UserAvatarForUsernameProps> = ({ us
|
|||
}
|
||||
}, [username, t])
|
||||
|
||||
if (!value) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<AsyncLoadingBoundary loading={loading} error={error} componentName={'UserAvatarForUsername'}>
|
||||
<UserAvatar user={value} {...props} />
|
||||
<AsyncLoadingBoundary loading={loading || !value} error={error} componentName={'UserAvatarForUsername'}>
|
||||
<UserAvatar user={value as UserInfo} {...props} />
|
||||
</AsyncLoadingBoundary>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue