From d80db29a023a5ef6cb592fb587c60b36469b3799 Mon Sep 17 00:00:00 2001 From: 1xDed Date: Tue, 1 Dec 2026 11:09:32 +0300 Subject: [PATCH] fix(player): stop the cover flicker after the crossfade - the incoming sleeve keeps its static class after the old one is removed, so its fade-in animation no longer restarts ~0.6s later (the flicker) --- src/routes/_api/player/audio.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/_api/player/audio.tsx b/src/routes/_api/player/audio.tsx index d91f64b..da2ca54 100644 --- a/src/routes/_api/player/audio.tsx +++ b/src/routes/_api/player/audio.tsx @@ -133,6 +133,7 @@ const CoverArt = ({ src, alt }: { src?: string; alt: string }) => { const [current, setCurrent] = useState(src); const [previous, setPrevious] = useState(); const currentRef = useRef(src); + const hasSwappedRef = useRef(false); const timerRef = useRef | null>(null); useEffect(() => { @@ -143,6 +144,7 @@ const CoverArt = ({ src, alt }: { src?: string; alt: string }) => { const start = () => { if (cancelled || begun) return; begun = true; + hasSwappedRef.current = true; setPrevious(currentRef.current); currentRef.current = src; setCurrent(src); @@ -186,7 +188,7 @@ const CoverArt = ({ src, alt }: { src?: string; alt: string }) => {