mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Persist lyrics queries in indexeddb
This commit is contained in:
parent
adfa748bfb
commit
ee83fdba71
6 changed files with 138 additions and 32 deletions
|
|
@ -86,7 +86,7 @@ export const useSongLyricsBySong = (
|
|||
const server = getServerById(song?.serverId);
|
||||
|
||||
return useQuery({
|
||||
cacheTime: 1000 * 60 * 10,
|
||||
cacheTime: Infinity,
|
||||
enabled: !!song && !!server,
|
||||
onError: () => {},
|
||||
queryFn: async ({ signal }) => {
|
||||
|
|
@ -138,7 +138,7 @@ export const useSongLyricsBySong = (
|
|||
return null;
|
||||
},
|
||||
queryKey: queryKeys.songs.lyrics(server?.id || '', query),
|
||||
staleTime: 1000 * 60 * 2,
|
||||
staleTime: Infinity,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export const SynchronizedLyrics = ({
|
|||
'sychronized-lyrics-scroll-container',
|
||||
) as HTMLElement;
|
||||
const currentLyric = document.querySelector(`#lyric-${index}`) as HTMLElement;
|
||||
const offsetTop = currentLyric?.offsetTop - doc?.clientHeight / 2 ?? 0;
|
||||
const offsetTop = currentLyric.offsetTop - doc.clientHeight / 2 ?? 0;
|
||||
|
||||
if (currentLyric === null) {
|
||||
lyricRef.current = undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue