Skip to content

Commit d5ab272

Browse files
committed
Fix useAsync mounted check race condition
1 parent 931a675 commit d5ab272

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ui/hooks/useAsync.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ export function useAsyncCallback<T>(
9393
const [result, setResult] = useState<AsyncResult<T>>(RESULT_IDLE);
9494

9595
// Track component mount state
96-
const isMounted = useRef(false);
96+
const isMounted = useRef(true);
9797

9898
// Update ref when component unmounts
9999
useEffect(() => {
100-
isMounted.current = true;
101100
return () => {
102101
isMounted.current = false;
103102
};

0 commit comments

Comments
 (0)