kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Fix multiple setTimeout calls by clearing the previous one
rodzic
5f874b87c1
commit
1932ec126c
|
@ -482,7 +482,11 @@ const Video: React.FC<IVideo> = ({
|
|||
const playerStyle: React.CSSProperties = {};
|
||||
|
||||
const startTimeout = () => {
|
||||
timeoutRef.current = setTimeout(() => setHovered(false), 1000);
|
||||
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
||||
timeoutRef.current = setTimeout(() => {
|
||||
setHovered(false);
|
||||
timeoutRef.current = null;
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
if (inline && containerWidth) {
|
||||
|
|
Ładowanie…
Reference in New Issue