perf(app): load embed author and footer icons through the image cache (#1756)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-19 17:38:00 +02:00
1 parent 2083eaddd6
commit ce41960fcd
3 files changed
+63 -2

No files matched your search

@@ -5,6 +5,7 @@ import styles from '@app/features/channel/components/embeds/ChannelEmbed.module.
import {EmbedLink} from '@app/features/channel/components/embeds/channel_embed/EmbedLink';
import {SafeMarkdown} from '@app/features/messaging/components/markdown';
import {MarkdownContext} from '@app/features/messaging/components/markdown/renderers/RendererTypes';
import {useCachedImageLoaded} from '@app/features/messaging/hooks/useCachedImageLoaded';
import {buildMediaProxyURL} from '@app/features/messaging/utils/MediaProxyUtils';
import * as DateUtils from '@app/features/user/utils/DateFormatting';
import type {EmbedAuthor, EmbedField, EmbedFooter} from '@fluxer/schema/src/domains/message/EmbedSchemas';
@@ -32,10 +33,11 @@ export const EmbedAuthorComponent: FC<{author?: EmbedAuthor}> = observer(({autho
const iconSrc = author?.proxy_icon_url
? buildMediaProxyURL(author.proxy_icon_url, animatedMediaPlaybackAllowed ? {} : {format: 'webp', animated: false})
: undefined;
const iconLoaded = useCachedImageLoaded(iconSrc);
if (!author) return null;
return (
<div className={styles.embedAuthor} data-flx="channel.embeds.embed.embed-author-component.embed-author">
{iconSrc && (
{iconSrc && iconLoaded && (
<img
alt=""
className={styles.embedAuthorIcon}
@@ -181,13 +183,14 @@ export const EmbedFooterComponent: FC<{
const iconSrc = footer?.proxy_icon_url
? buildMediaProxyURL(footer.proxy_icon_url, animatedMediaPlaybackAllowed ? {} : {format: 'webp', animated: false})
: undefined;
const iconLoaded = useCachedImageLoaded(iconSrc);
if (!(footer || formattedTimestamp)) return null;
return (
<div
className={clsx(styles.embedFooter, footer?.proxy_icon_url && styles.hasThumbnail)}
data-flx="channel.embeds.embed.embed-footer-component.embed-footer"
>
{iconSrc && (
{iconSrc && iconLoaded && (
<img
alt=""
className={styles.embedFooterIcon}