Verified Commit c1b57a4f authored by Florent Chehab's avatar Florent Chehab
Browse files

fix(FullScreenDialog*): safer component, less memory leaks

parent 407f7253
......@@ -19,6 +19,8 @@ function FullScreenDialogServiceComponent() {
const [children, setChildren] = useState(undefined);
useEffect(() => {
FullScreenDialogService.setSetChildrenComponent(setChildren);
return () => FullScreenDialogService.setSetChildrenComponent(undefined);
}, []);
const open = useMemo(() => typeof children !== "undefined", [children]);
......
......@@ -16,11 +16,15 @@ class FullScreenDialogService {
};
closeDialog = () => {
this._setChildren(undefined);
if (typeof this._setChildren !== "undefined") {
this._setChildren(undefined);
}
};
openDialog = children => {
this._setChildren(children);
if (typeof this._setChildren !== "undefined") {
this._setChildren(children);
}
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment