From 6477307b2edf95a17ce4fadf0a0b16b30f36b1ee Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 8 Mar 2026 12:40:07 +0200 Subject: [PATCH] Fix sidebar layout shift on load --- app/components/SideNav.tsx | 7 ++++++- app/components/StreamListItems.tsx | 24 ++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/components/SideNav.tsx b/app/components/SideNav.tsx index e9598ca10..7f19edb1d 100644 --- a/app/components/SideNav.tsx +++ b/app/components/SideNav.tsx @@ -121,7 +121,12 @@ export function ListLink({ {subtitle || badge ? (
{subtitle ? ( - {subtitle} + + {subtitle} + ) : null} {typeof badge === "string" ? ( void; }) { const { t, i18n } = useTranslation(["front"]); - const isMounted = useIsMounted(); const formatRelativeDate = (timestamp: number) => { const date = new Date(timestamp * 1000); @@ -60,7 +58,7 @@ export function StreamListItems({ const prevIsLive = prevStream && databaseTimestampToDate(prevStream.startsAt).getTime() <= Date.now(); - const showUpcomingDivider = isMounted && isUpcoming && prevIsLive; + const showUpcomingDivider = isUpcoming && prevIsLive; return ( @@ -85,22 +83,16 @@ export function StreamListItems({ ) : stream.subtitle ? ( stream.subtitle - ) : isMounted ? ( - isUpcoming ? ( - formatRelativeDate(stream.startsAt) - ) : ( - formatDistanceToNow(startsAtDate, { - addSuffix: true, - language: i18n.language as LanguageCode, - }) - ) + ) : isUpcoming ? ( + formatRelativeDate(stream.startsAt) ) : ( - "" + formatDistanceToNow(startsAtDate, { + addSuffix: true, + language: i18n.language as LanguageCode, + }) ) } - badge={ - isMounted && !isUpcoming ? "LIVE" : streamTierBadge(stream) - } + badge={!isUpcoming ? "LIVE" : streamTierBadge(stream)} onClick={onClick} > {stream.name}