mirror of
https://github.com/Radarr/Radarr
synced 2026-05-09 06:03:57 +02: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 isLoading = useRef(false);
|
||||||
const requestValue = useRef<string | null>(null);
|
const requestValue = useRef<string | null>(null);
|
||||||
const requestLoadingRef = useRef(false);
|
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 suggestionGroups = useMemo(() => {
|
||||||
const result: Section[] = [];
|
const result: Section[] = [];
|
||||||
|
|
@ -203,7 +207,7 @@ function MovieSearchInput() {
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
value,
|
value,
|
||||||
movies,
|
movies: moviesRef.current,
|
||||||
};
|
};
|
||||||
|
|
||||||
worker.current?.postMessage(payload);
|
worker.current?.postMessage(payload);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue