mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-09 12:09:57 +02:00
simplify lyrics implementation
- removes complex lyrics fetch and override logic, and instead uses a single query as a source of truth for the lyrics - properly handles loading state, invalidation, and refetch
This commit is contained in:
@@ -117,13 +117,13 @@ export const LyricsSearchForm = ({ artist, name, onSearchOverride }: LyricSearch
|
||||
const [debouncedArtist] = useDebouncedValue(form.values.artist, 500);
|
||||
const [debouncedName] = useDebouncedValue(form.values.name, 500);
|
||||
|
||||
const { data, isInitialLoading } = useQuery(
|
||||
const { data, isLoading } = useQuery(
|
||||
lyricsQueries.search({
|
||||
query: { artist: debouncedArtist, name: debouncedName },
|
||||
}),
|
||||
);
|
||||
|
||||
const { data: previewData, isInitialLoading: isPreviewLoading } = useQuery(
|
||||
const { data: previewData, isLoading: isPreviewLoading } = useQuery(
|
||||
lyricsQueries.songLyricsByRemoteId({
|
||||
options: {
|
||||
enabled: !!selectedResult,
|
||||
@@ -228,7 +228,7 @@ export const LyricsSearchForm = ({ artist, name, onSearchOverride }: LyricSearch
|
||||
paddingRight: '1rem',
|
||||
}}
|
||||
>
|
||||
{isInitialLoading ? (
|
||||
{isLoading ? (
|
||||
<Spinner container />
|
||||
) : (
|
||||
<Stack gap="md">
|
||||
|
||||
Reference in New Issue
Block a user