mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-21 11:24:26 +02:00
refactor playlist route component organization
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useParams } from 'react-router';
|
||||
import { useLocation, useParams } from 'react-router';
|
||||
|
||||
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
||||
import { useListContext } from '/@/renderer/context/list-context';
|
||||
@@ -28,11 +28,13 @@ export const PlaylistDetailSongListHeader = ({
|
||||
const { playlistId } = useParams() as { playlistId: string };
|
||||
const { itemCount } = useListContext();
|
||||
const server = useCurrentServer();
|
||||
const detailQuery = useQuery(
|
||||
playlistsQueries.detail({ query: { id: playlistId }, serverId: server?.id }),
|
||||
);
|
||||
const location = useLocation();
|
||||
|
||||
const detailQuery = useQuery({
|
||||
...playlistsQueries.detail({ query: { id: playlistId }, serverId: server?.id }),
|
||||
initialData: location.state?.item,
|
||||
});
|
||||
|
||||
if (detailQuery.isLoading) return null;
|
||||
const isSmartPlaylist = isSmartPlaylistProp ?? detailQuery?.data?.rules;
|
||||
const playlistDuration = detailQuery?.data?.duration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user