Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
c1b57a4f
Verified
Commit
c1b57a4f
authored
Apr 11, 2020
by
Florent Chehab
Browse files
fix(FullScreenDialog*): safer component, less memory leaks
parent
407f7253
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/services/FullScreenDialogServiceComponent.jsx
View file @
c1b57a4f
...
...
@@ -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
]);
...
...
frontend/src/services/FullScreenDialogService.js
View file @
c1b57a4f
...
...
@@ -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
);
}
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment