fix(media): keep self-host media loading after restarts (#3283)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-08 17:28:18 +02:00
1 parent bd56174870
commit 46a356cc40
59 files changed
+1238 -499

No files matched your search

@@ -4,6 +4,7 @@ import {useHover} from '@app/features/app/hooks/useHover';
import {useShouldAnimate} from '@app/features/app/hooks/useShouldAnimate';
import styles from '@app/features/guild/components/popouts/GuildIcon.module.css';
import {getGuildIconDisplayInitials, getInitialsLength} from '@app/features/guild/utils/GuildInitialsUtils';
import {useRecoveringBackgroundImageURL} from '@app/features/messaging/hooks/useImageRecovery';
import * as ImageCacheUtils from '@app/features/messaging/utils/ImageCacheUtils';
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import * as AvatarUtils from '@app/features/user/utils/AvatarUtils';
@@ -52,8 +53,9 @@ export const GuildIcon = observer(function GuildIcon({
if (!animationAllowed || hoverIconUrl == null || isAnimatedLoaded) return;
return ImageCacheUtils.loadImage(hoverIconUrl, () => setLoadedAnimatedUrl(hoverIconUrl));
}, [animationAllowed, hoverIconUrl, isAnimatedLoaded]);
const activeUrl = animationAllowed && isAnimatedLoaded ? hoverIconUrl : iconUrl;
const paintedUrl = activeUrl != null && activeUrl.length > 0 ? activeUrl : null;
const paintableIconUrl = useRecoveringBackgroundImageURL(iconUrl ?? '');
const activeUrl = animationAllowed && isAnimatedLoaded ? hoverIconUrl : paintableIconUrl;
const paintedUrl = paintableIconUrl != null && activeUrl != null && activeUrl.length > 0 ? activeUrl : null;
const styleVars: GuildIconStyleVars = {};
if (sizePx != null) {
styleVars['--guild-icon-size'] = remFromPx(sizePx);