mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-16 21:28:24 +03:00
revert unneeded changes
re-rendering was caused by the overlay state hook, not this one
This commit is contained in:
parent
adbc4bd71c
commit
e10ea2e071
@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
const useImageLoaded = (): [
|
const useImageLoaded = (): [
|
||||||
React.RefObject<HTMLImageElement | null>,
|
React.RefObject<HTMLImageElement | null>,
|
||||||
@ -8,15 +8,15 @@ const useImageLoaded = (): [
|
|||||||
const [loaded, setLoaded] = useState(false);
|
const [loaded, setLoaded] = useState(false);
|
||||||
const ref = useRef<HTMLImageElement>(null);
|
const ref = useRef<HTMLImageElement>(null);
|
||||||
|
|
||||||
const onLoad = useCallback(() => {
|
const onLoad = () => {
|
||||||
setLoaded(true);
|
setLoaded(true);
|
||||||
}, []);
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (ref.current?.complete) {
|
if (ref.current && ref.current?.complete) {
|
||||||
onLoad();
|
onLoad();
|
||||||
}
|
}
|
||||||
}, [onLoad]);
|
});
|
||||||
|
|
||||||
return [ref, loaded, onLoad];
|
return [ref, loaded, onLoad];
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user