mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-19 17:32:38 +01:00
Fixed: Improve filtering performance in Select Movie Modal
This commit is contained in:
parent
6ed3045433
commit
270df9d1dd
@ -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(
|
||||
(item) =>
|
||||
item.title.toLowerCase().includes(filter.toLowerCase()) ||
|
||||
item.tmdbId.toString().includes(filter) ||
|
||||
item.imdbId?.includes(filter)
|
||||
);
|
||||
}, [allMovies, filter]);
|
||||
const items = useMemo(
|
||||
() =>
|
||||
sortedMovies.filter(
|
||||
(item) =>
|
||||
item.title.toLowerCase().includes(filter.toLowerCase()) ||
|
||||
item.tmdbId.toString().includes(filter) ||
|
||||
item.imdbId?.includes(filter)
|
||||
),
|
||||
[sortedMovies, filter]
|
||||
);
|
||||
|
||||
return (
|
||||
<ModalContent onModalClose={onModalClose}>
|
||||
|
Loading…
Reference in New Issue
Block a user