Skip to content

Commit 57b056a

Browse files
committed
FE: Fix tests for connect list
1 parent d195002 commit 57b056a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frontend/src/components/common/Portal/Portal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ type PortalProps = {
99

1010
const Portal: FC<PropsWithChildren<PortalProps>> = memo(
1111
({ isOpen, children }) => {
12-
const content = isOpen ? <S.Backdrop>{children}</S.Backdrop> : null;
12+
const target = document.getElementById('portal-root');
1313

14-
return createPortal(content, document.getElementById('portal-root')!);
14+
if (target == null) {
15+
return null;
16+
}
17+
18+
return isOpen
19+
? createPortal(<S.Backdrop>{children}</S.Backdrop>, target)
20+
: null;
1521
}
1622
);
1723

0 commit comments

Comments
 (0)