fix lyrics components

This commit is contained in:
jeffvli
2025-11-18 03:33:18 -08:00
parent 7b9007c699
commit e45c126a3f
4 changed files with 61 additions and 121 deletions
+8 -12
View File
@@ -19,8 +19,9 @@ import {
UnsynchronizedLyrics,
UnsynchronizedLyricsProps,
} from '/@/renderer/features/lyrics/unsynchronized-lyrics';
import { usePlayerEvents } from '/@/renderer/features/player/audio-player/hooks/use-player-events';
import { queryClient } from '/@/renderer/lib/react-query';
import { usePlayerSong, useLyricsSettings, usePlayerStore } from '/@/renderer/store';
import { useLyricsSettings, usePlayerSong } from '/@/renderer/store';
import { Center } from '/@/shared/components/center/center';
import { Group } from '/@/shared/components/group/group';
import { Icon } from '/@/shared/components/icon/icon';
@@ -130,22 +131,17 @@ export const Lyrics = () => {
}),
);
useEffect(() => {
const unsubSongChange = usePlayerStore.subscribe(
(state) => state.current.song,
() => {
usePlayerEvents(
{
onCurrentSongChange: () => {
setOverride(undefined);
setIndex(0);
setShowTranslation(false);
setTranslatedLyrics(null);
},
{ equalityFn: (a, b) => a?.id === b?.id },
);
return () => {
unsubSongChange();
};
}, []);
},
[],
);
useEffect(() => {
if (lyrics && !translatedLyrics && enableAutoTranslation) {