1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Backport pull request #5661 from jellyfin-web/release-10.9.z

Use display missing episodes setting in search

Original-merge: 2a110f6b5d

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
thornbill 2024-06-05 17:03:52 -04:00 committed by Joshua M. Boniface
parent 0e07d8a19a
commit 1688829caf

View file

@ -1,4 +1,5 @@
import type { BaseItemDto, BaseItemDtoQueryResult } from '@jellyfin/sdk/lib/generated-client';
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import type { ApiClient } from 'jellyfin-apiclient';
import classNames from 'classnames';
import React, { type FC, useCallback, useEffect, useState } from 'react';
@ -77,16 +78,32 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
).then(ensureNonNullItems)
), [getDefaultParameters]);
const fetchItems = useCallback((apiClient: ApiClient, params = {}) => (
apiClient?.getItems(
apiClient.getCurrentUserId(),
{
const fetchItems = useCallback(async (apiClient?: ApiClient, params = {}) => {
if (!apiClient) {
console.error('[SearchResults] no apiClient; unable to fetch items');
return {
Items: []
};
}
const options = {
...getDefaultParameters(),
IncludeMedia: true,
...params
};
if (params.IncludeItemTypes === BaseItemKind.Episode) {
const user = await apiClient.getCurrentUser();
if (!user?.Configuration?.DisplayMissingEpisodes) {
options.IsMissing = false;
}
).then(ensureNonNullItems)
), [getDefaultParameters]);
}
return apiClient.getItems(
apiClient.getCurrentUserId(),
options
).then(ensureNonNullItems);
}, [getDefaultParameters]);
const fetchPeople = useCallback((apiClient: ApiClient, params = {}) => (
apiClient?.getPeople(