From 8c3bd354f83abe786165ec98eae9c8128e2e53a8 Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sun, 26 May 2024 20:53:43 +0100 Subject: [PATCH] Misc: Remove FileSummary - fetching/loading behaviour --- .../Collection/Files/FilesSummaryGroup.tsx | 19 +++++-------------- src/core/react-query/webui/queries.ts | 1 - .../collection/series/SeriesFileSummary.tsx | 4 ++-- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/components/Collection/Files/FilesSummaryGroup.tsx b/src/components/Collection/Files/FilesSummaryGroup.tsx index 6aee2faf6..c296da12f 100644 --- a/src/components/Collection/Files/FilesSummaryGroup.tsx +++ b/src/components/Collection/Files/FilesSummaryGroup.tsx @@ -1,9 +1,6 @@ import React, { useMemo } from 'react'; -import { mdiLoading } from '@mdi/js'; -import Icon from '@mdi/react'; import { forEach, map, omit } from 'lodash'; import prettyBytes from 'pretty-bytes'; -import { useDebounceValue } from 'usehooks-ts'; import type { WebuiSeriesFileSummaryGroupRangeByType, WebuiSeriesFileSummaryGroupType } from '@/core/types/api/webui'; @@ -23,14 +20,12 @@ const HeaderFragment = ({ range, title }: HeaderFragmentProps) => { type HeaderProps = { ranges: WebuiSeriesFileSummaryGroupRangeByType; - fetchingState: boolean; }; -const Header = ({ fetchingState, ranges }: HeaderProps) => ( +const Header = ({ ranges }: HeaderProps) => (
2 ? 'Episodes' : 'Episode'} range={ranges?.Normal?.Range} /> 2 ? 'Specials' : 'Special'} range={ranges?.Special?.Range} /> {map(omit(ranges, ['Normal', 'Special']), (item, key) => )} - {fetchingState && }
); @@ -51,9 +46,8 @@ const Row = ({ label, value }: RowProps) => ( type GroupProps = { group: WebuiSeriesFileSummaryGroupType; - fetchingState: boolean; }; -const Group = ({ fetchingState, group }: GroupProps) => { +const Group = ({ group }: GroupProps) => { const sizes = useMemo(() => { const sizeMap: Record = {}; forEach(group.RangeByType, (item, key) => { @@ -76,8 +70,6 @@ const Group = ({ fetchingState, group }: GroupProps) => { )).join(' | '); }, [group]); - const [fetchState] = useDebounceValue(fetchingState, 500); - const groupDetails = useMemo(() => (group.GroupName ? `${group.GroupName} (${group.GroupNameShort})` : '-'), [ group, ]); @@ -133,7 +125,7 @@ const Group = ({ fetchingState, group }: GroupProps) => { return (
-
+
@@ -153,11 +145,10 @@ const Group = ({ fetchingState, group }: GroupProps) => { type Props = { groups?: WebuiSeriesFileSummaryGroupType[]; - fetchingState: boolean; }; -const FilesSummaryGroups = ({ fetchingState, groups = [] }: Props) => ( +const FilesSummaryGroups = ({ groups = [] }: Props) => ( // eslint-disable-next-line react/no-array-index-key - groups.map((group, index) => ) + groups.map((group, index) => ) ); export default FilesSummaryGroups; diff --git a/src/core/react-query/webui/queries.ts b/src/core/react-query/webui/queries.ts index 8c72fd265..2c1bd839b 100644 --- a/src/core/react-query/webui/queries.ts +++ b/src/core/react-query/webui/queries.ts @@ -51,7 +51,6 @@ export const useSeriesFileSummaryQuery = (seriesId: number, params: SeriesFileSu queryKey: ['webui', 'series-file-summary', seriesId, params], queryFn: () => axios.get(`WebUI/Series/${seriesId}/FileSummary`, { params }), enabled, - placeholderData: prevData => prevData, }); export const useSeriesOverviewQuery = (seriesId: number, enabled = true) => diff --git a/src/pages/collection/series/SeriesFileSummary.tsx b/src/pages/collection/series/SeriesFileSummary.tsx index 051cb15a0..7cbf090fa 100644 --- a/src/pages/collection/series/SeriesFileSummary.tsx +++ b/src/pages/collection/series/SeriesFileSummary.tsx @@ -51,7 +51,7 @@ const SeriesFileSummary = () => { const [mode, setMode] = useState('Series'); - const { data: fileSummary, isFetching, isLoading } = useSeriesFileSummaryQuery( + const { data: fileSummary, isLoading } = useSeriesFileSummaryQuery( toNumber(seriesId!), { groupBy: 'GroupName,FileVersion,FileLocation,AudioLanguages,SubtitleLanguages,VideoResolution' }, !!seriesId, @@ -79,7 +79,7 @@ const SeriesFileSummary = () => {
)} {mode === 'Series' - ? + ? : }