1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-01-20 14:19:46 +00: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] [allSeries, onSeriesSelect]
); );
const items = useMemo(() => { const sortedSeries = useMemo(
const sorted = [...allSeries].sort(sortByProp('sortTitle')); () => [...allSeries].sort(sortByProp('sortTitle')),
[allSeries]
);
return sorted.filter( const items = useMemo(
() =>
sortedSeries.filter(
(item) => (item) =>
item.title.toLowerCase().includes(filter.toLowerCase()) || item.title.toLowerCase().includes(filter.toLowerCase()) ||
item.tvdbId.toString().includes(filter) || item.tvdbId.toString().includes(filter) ||
item.imdbId?.includes(filter) item.imdbId?.includes(filter)
),
[sortedSeries, filter]
); );
}, [allSeries, filter]);
return ( return (
<ModalContent onModalClose={onModalClose}> <ModalContent onModalClose={onModalClose}>