Remove avatar loading state to avoid flicker

Original reason why it's there (by hfcRed): If you render someones icon, it exports it as an image and puts in the cache, so when you navigate and that same person appears again on the next page, it pulls the rendered image from the cache and uses that instead of a canvas

But could not reproduce any kind of "pop in".
This commit is contained in:
Kalle
2026-06-20 14:20:17 +03:00
parent c64397c347
commit dd5d98a243
2 changed files with 0 additions and 20 deletions

View File

@@ -1,12 +1,3 @@
.identicon {
filter: blur(99px);
transition: filter 0.3s;
}
.loaded {
filter: blur(0);
}
.avatarWrapper {
flex-shrink: 0;
width: fit-content;

View File

@@ -120,14 +120,8 @@ export function Avatar({
size: keyof typeof dimensions;
} & React.ButtonHTMLAttributes<HTMLImageElement>) {
const [isErrored, setIsErrored] = React.useState(false);
const [loaded, setLoaded] = React.useState(false);
const isClient = useHydrated();
const isIdenticon =
!url &&
(!user?.customAvatarUrl || isErrored) &&
(!user?.discordAvatar || isErrored || identiconInput);
const identiconSource = identiconInput ?? user?.discordId ?? "unknown";
const src = url
@@ -147,17 +141,12 @@ export function Avatar({
return (
<div className={clsx(styles.avatarWrapper, className)}>
<img
className={clsx({
[styles.identicon]: isIdenticon,
[styles.loaded]: loaded,
})}
src={src}
alt={alt}
title={alt ? alt : undefined}
width={dimensions[size]}
height={dimensions[size]}
onError={() => setIsErrored(true)}
onLoad={() => setLoaded(true)}
{...rest}
/>
</div>