fix member flicker (use recoil-cached image src)
This commit is contained in:
parent
80620a1b62
commit
3849d6b447
@ -111,14 +111,11 @@ const MessageElement: FC<MessageElementProps> = (props: MessageElementProps) =>
|
|||||||
[message, prevMessage],
|
[message, prevMessage],
|
||||||
);
|
);
|
||||||
|
|
||||||
const [avatarSrc] = useOneTimeAsyncAction(
|
const avatarSrc = useRecoilValueSoftImgSrc(
|
||||||
async () => {
|
guildResourceSoftImgSrcState({
|
||||||
if (message.isContinued(prevMessage)) return './img/loading.svg'; // don't load for elements that won't use it
|
guildId: guild.id,
|
||||||
if (!(message.member instanceof Member)) return './img/error.png'; // TODO: Make this a nicer 'unknown' image
|
resourceId: message.member instanceof Member ? message.member.avatarResourceId : null,
|
||||||
return await ElementsUtil.getImageSrcFromResourceFailSoftly(guild, message.member.avatarResourceId);
|
}),
|
||||||
},
|
|
||||||
'./img/loading.svg',
|
|
||||||
[message],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const dateSpacer = useMemo(() => {
|
const dateSpacer = useMemo(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user