Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(dialog): cancel hide timeout on openDialog

Hristo Terezov48ed3b7dc6b7
diff --git a/react/features/base/ui/components/web/DialogTransition.tsx b/react/features/base/ui/components/web/DialogTransition.tsx
index 408a0d3a75..4727758993 100644
--- a/react/features/base/ui/components/web/DialogTransition.tsx
+++ b/react/features/base/ui/components/web/DialogTransition.tsx
@@ -2,18 +2,29 @@ import React, { ReactElement, useEffect, useState } from 'react';
export const DialogTransitionContext = React.createContext({ isUnmounting: false });
+type TimeoutType = ReturnType<typeof setTimeout>;
+
const DialogTransition = ({ children }: { children: ReactElement | null; }) => {
const [ childrenToRender, setChildrenToRender ] = useState(children);
const [ isUnmounting, setIsUnmounting ] = useState(false);
+ const [ timeoutID, setTimeoutID ] = useState<TimeoutType | undefined>(undefined);
useEffect(() => {
if (children === null) {
setIsUnmounting(true);
- setTimeout(() => {
- setChildrenToRender(children);
- setIsUnmounting(false);
- }, 150);
+ if (typeof timeoutID === 'undefined') {
+ setTimeoutID(setTimeout(() => {
+ setChildrenToRender(children);
+ setIsUnmounting(false);
+ setTimeoutID(undefined);
+ }, 150));
+ }
} else {
+ if (typeof timeoutID !== 'undefined') {
+ clearTimeout(timeoutID);
+ setTimeoutID(undefined);
+ setIsUnmounting(false);
+ }
setChildrenToRender(children);
}
}, [ children ]);