1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-24 08:42:19 +02:00

Fixed: Improve performance in Select Series Modal

This commit is contained in:
Bogdan 2024-07-25 07:32:09 +03:00 committed by GitHub
parent bde5f68142
commit 1ad722acda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -163,16 +163,21 @@ function SelectSeriesModalContent(props: SelectSeriesModalContentProps) {
[allSeries, onSeriesSelect]
);
const items = useMemo(() => {
const sorted = [...allSeries].sort(sortByProp('sortTitle'));
const sortedSeries = useMemo(
() => [...allSeries].sort(sortByProp('sortTitle')),
[allSeries]
);
return sorted.filter(
(item) =>
item.title.toLowerCase().includes(filter.toLowerCase()) ||
item.tvdbId.toString().includes(filter) ||
item.imdbId?.includes(filter)
);
}, [allSeries, filter]);
const items = useMemo(
() =>
sortedSeries.filter(
(item) =>
item.title.toLowerCase().includes(filter.toLowerCase()) ||
item.tvdbId.toString().includes(filter) ||
item.imdbId?.includes(filter)
),
[sortedSeries, filter]
);
return (
<ModalContent onModalClose={onModalClose}>