Prevent wrong initial color on navigation on the same route

This commit is contained in:
jeffvli 2023-07-21 18:51:37 -07:00
parent 48eaddbeda
commit 853770ea8e
7 changed files with 62 additions and 38 deletions

View file

@ -122,7 +122,11 @@ export const FullScreenPlayerImage = () => {
const { queue } = usePlayerData();
const useImageAspectRatio = useFullScreenPlayerStore((state) => state.useImageAspectRatio);
const currentSong = queue.current;
const background = useFastAverageColor(queue.current?.imageUrl, true, 'dominant');
const { color: background } = useFastAverageColor({
algorithm: 'dominant',
src: queue.current?.imageUrl,
srcLoaded: true,
});
const imageKey = `image-${background}`;
const [imageState, setImageState] = useSetState({

View file

@ -193,7 +193,11 @@ export const FullScreenPlayer = () => {
}, [location, setStore]);
const currentSong = useCurrentSong();
const background = useFastAverageColor(currentSong?.imageUrl, true, 'dominant');
const { color: background } = useFastAverageColor({
algorithm: 'dominant',
src: currentSong?.imageUrl,
srcLoaded: true,
});
return (
<Container