1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

Fixed: Improve filtering performance in Select Movie Modal

This commit is contained in:
Bogdan 2024-07-25 07:23:32 +03:00 committed by GitHub
parent 6ed3045433
commit 270df9d1dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -162,16 +162,21 @@ function SelectMovieModalContent(props: SelectMovieModalContentProps) {
[allMovies, onMovieSelect]
);
const items = useMemo(() => {
const sorted = [...allMovies].sort(sortByProp('sortTitle'));
const sortedMovies = useMemo(
() => [...allMovies].sort(sortByProp('sortTitle')),
[allMovies]
);
return sorted.filter(
const items = useMemo(
() =>
sortedMovies.filter(
(item) =>
item.title.toLowerCase().includes(filter.toLowerCase()) ||
item.tmdbId.toString().includes(filter) ||
item.imdbId?.includes(filter)
),
[sortedMovies, filter]
);
}, [allMovies, filter]);
return (
<ModalContent onModalClose={onModalClose}>