mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-12 13:39:58 +02:00
fix lyrics loading state
This commit is contained in:
@@ -108,7 +108,10 @@ export const Lyrics = ({ fadeOutNoLyricsMessage = true, settingsKey = 'default'
|
||||
return queryKeys.songs.lyrics(currentSong._serverId, { songId: currentSong.id });
|
||||
}, [currentSong]);
|
||||
|
||||
const { data, isLoading } = useQuery(
|
||||
const shouldFetchLyrics = !isLyricsDisabled && !!currentSong?._serverId && !!currentSong?.id;
|
||||
const isWaitingToFetchLyrics = shouldFetchLyrics && pendingSongId !== currentSong?.id;
|
||||
|
||||
const { data, isFetching, isLoading } = useQuery(
|
||||
lyricsQueries.songLyrics(
|
||||
{
|
||||
options: {
|
||||
@@ -379,7 +382,9 @@ export const Lyrics = ({ fadeOutNoLyricsMessage = true, settingsKey = 'default'
|
||||
return [];
|
||||
}, [data?.local]);
|
||||
|
||||
const isLoadingLyrics = isLoading && !isLyricsDisabled;
|
||||
const isLoadingLyrics =
|
||||
shouldFetchLyrics &&
|
||||
(isWaitingToFetchLyrics || isLoading || (isFetching && !displayLyrics));
|
||||
const hasNoLyrics = !displayLyrics;
|
||||
const [shouldFadeOut, setShouldFadeOut] = useState(false);
|
||||
|
||||
@@ -431,7 +436,7 @@ export const Lyrics = ({ fadeOutNoLyricsMessage = true, settingsKey = 'default'
|
||||
) : (
|
||||
<AnimatePresence mode="sync">
|
||||
{hasNoLyrics ? (
|
||||
<Center w="100%">
|
||||
<Center flex={1} w="100%">
|
||||
<motion.div
|
||||
animate={{ opacity: shouldFadeOut ? 0 : 1 }}
|
||||
initial={{ opacity: 1 }}
|
||||
|
||||
Reference in New Issue
Block a user