Merge pull request #8299 from thornbill/fix-livetv-id

This commit is contained in:
Bill Thornton
2026-08-01 11:00:21 -04:00
committed by GitHub
5 changed files with 7 additions and 13 deletions
@@ -34,7 +34,6 @@ const PageTabContent: FC<PageTabContentProps> = ({ parentId, currentTab }) => {
if (currentTab.viewType === LibraryTab.Programs || currentTab.viewType === LibraryTab.Recordings || currentTab.viewType === LibraryTab.Schedule) {
return (
<ProgramsSectionView
parentId={parentId}
sectionType={
currentTab.sectionsView?.programSections ?? []
}
@@ -9,22 +9,19 @@ import { ItemAction } from 'constants/itemAction';
import { useApi } from 'hooks/useApi';
import { useGetProgramsSectionsWithItems, useGetTimers } from 'hooks/useFetchItems';
import globalize from 'lib/globalize';
import type { ParentId } from 'types/library';
import type { Section, SectionType } from 'types/sections';
interface ProgramsSectionViewProps {
parentId: ParentId;
sectionType: SectionType[];
isUpcomingRecordingsEnabled: boolean | undefined
}
const ProgramsSectionView: FC<ProgramsSectionViewProps> = ({
parentId,
sectionType,
isUpcomingRecordingsEnabled = false
}) => {
const { __legacyApiClient__ } = useApi();
const { isLoading, data: sectionsWithItems, refetch } = useGetProgramsSectionsWithItems(parentId, sectionType);
const { isLoading, data: sectionsWithItems, refetch } = useGetProgramsSectionsWithItems(sectionType);
const {
isLoading: isUpcomingRecordingsLoading,
data: upcomingRecordings
@@ -35,7 +35,7 @@ export const useLibrary = () => useContext(LibraryContext);
export const LibraryProvider: FC<PropsWithChildren<unknown>> = ({ children }) => {
const { pathname } = useLocation();
const { libraryId, activeTab } = useCurrentTab();
const { libraryId, activeTab, settingsKey } = useCurrentTab();
const route = useMemo(() => LibraryRoutes.find(({ path }) => path === pathname), [pathname]);
const collectionType = route?.type;
@@ -48,7 +48,7 @@ export const LibraryProvider: FC<PropsWithChildren<unknown>> = ({ children }) =>
// Local storage requires the view type to be known upfront so default to movies if unknown
const settingsViewType = viewType ?? LibraryTab.Movies;
const [viewSettings, setViewSettings] = useLocalStorage<LibraryViewSettings>(
getSettingsKey(settingsViewType, libraryId),
getSettingsKey(settingsViewType, settingsKey),
getDefaultLibraryViewSettings(settingsViewType)
);
+3 -4
View File
@@ -6,10 +6,8 @@ const useCurrentTab = () => {
const location = useLocation();
const [searchParams, setSearchParams] = useSearchParams();
const searchParamsTab = searchParams.get('tab');
const libraryId =
location.pathname === '/livetv' ?
'livetv' :
searchParams.get('topParentId');
const libraryId = searchParams.get('topParentId');
const settingsKey = location.pathname === '/livetv' ? 'livetv' : libraryId;
const activeTab: number =
searchParamsTab !== null ?
parseInt(searchParamsTab, 10) :
@@ -19,6 +17,7 @@ const useCurrentTab = () => {
searchParams,
setSearchParams,
libraryId,
settingsKey,
activeTab
};
};
+1 -2
View File
@@ -954,14 +954,13 @@ export const useGetSuggestionSectionsWithItems = (
};
export const useGetProgramsSectionsWithItems = (
parentId: ParentId,
programSectionType: SectionType[]
) => {
const currentApi = useApi();
const sections = getProgramSections();
return useQuery({
queryKey: ['ProgramSectionWithItems', { programSectionType }],
queryFn: ({ signal }) => getSectionsWithItems(currentApi, parentId, sections, programSectionType, { signal }),
queryFn: ({ signal }) => getSectionsWithItems(currentApi, undefined, sections, programSectionType, { signal }),
enabled: !!currentApi.api && !!currentApi.user?.Id
});
};