mirror of
https://github.com/Radarr/Radarr
synced 2026-01-21 15:03:47 +01:00
fix(frontend): use ref to avoid stale movies closure in search (#103)
Co-authored-by: admin <admin@ardentleatherworks.com>
This commit is contained in:
parent
80912b7d43
commit
c07e5a697d
1 changed files with 5 additions and 1 deletions
|
|
@ -134,6 +134,10 @@ function MovieSearchInput() {
|
|||
const isLoading = useRef(false);
|
||||
const requestValue = useRef<string | null>(null);
|
||||
const requestLoadingRef = useRef(false);
|
||||
const moviesRef = useRef(movies);
|
||||
|
||||
// Keep moviesRef current to avoid stale closure in debounced callback
|
||||
moviesRef.current = movies;
|
||||
|
||||
const suggestionGroups = useMemo(() => {
|
||||
const result: Section[] = [];
|
||||
|
|
@ -203,7 +207,7 @@ function MovieSearchInput() {
|
|||
|
||||
const payload = {
|
||||
value,
|
||||
movies,
|
||||
movies: moviesRef.current,
|
||||
};
|
||||
|
||||
worker.current?.postMessage(payload);
|
||||
|
|
|
|||
Loading…
Reference in a new issue