improve library header loading

This commit is contained in:
Kendall Garner 2025-06-20 17:57:15 -07:00
parent b8ceb174b3
commit b7fb7c7f94
No known key found for this signature in database
GPG key ID: 9355F387FE765C94
9 changed files with 59 additions and 61 deletions

View file

@ -1,7 +1,7 @@
import { useRef } from 'react';
import { useParams } from 'react-router';
import { NativeScrollArea, Spinner } from '/@/renderer/components';
import { NativeScrollArea } from '/@/renderer/components';
import { AlbumArtistDetailContent } from '/@/renderer/features/artists/components/album-artist-detail-content';
import { AlbumArtistDetailHeader } from '/@/renderer/features/artists/components/album-artist-detail-header';
import { useAlbumArtistDetail } from '/@/renderer/features/artists/queries/album-artist-detail-query';
@ -30,7 +30,7 @@ const AlbumArtistDetailRoute = () => {
query: { id: routeId },
serverId: server?.id,
});
const { color: background, colorId } = useFastAverageColor({
const { background, colorId } = useFastAverageColor({
id: routeId,
src: detailQuery.data?.imageUrl,
srcLoaded: !detailQuery.isLoading,
@ -46,10 +46,6 @@ const AlbumArtistDetailRoute = () => {
});
};
if (!background || colorId !== routeId) {
return <Spinner container />;
}
return (
<AnimatedPage key={`album-artist-detail-${routeId}`}>
<NativeScrollArea
@ -70,6 +66,7 @@ const AlbumArtistDetailRoute = () => {
>
<AlbumArtistDetailHeader
background={background}
loading={!background || colorId !== routeId}
ref={headerRef}
/>
<AlbumArtistDetailContent background={background} />