Skip to content

Commit 0f62648

Browse files
committed
fix: side panel header action portal target not found
1 parent 33acdb0 commit 0f62648

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/common/SidePanel/SidePanelHeaderActions.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
import { PropsWithChildren } from 'react'
1+
import { PropsWithChildren, useEffect, useState } from 'react'
22
import { createPortal } from 'react-dom'
33

44
import { logExceptionToSentry } from '@devtron-labs/devtron-fe-common-lib'
55

66
export const SidePanelHeaderActions = ({ children }: PropsWithChildren<{}>) => {
7+
const [hasComponentRenderedOnce, setHasComponentRenderedOnce] = useState(false)
8+
9+
useEffect(() => {
10+
setHasComponentRenderedOnce(true)
11+
}, [])
12+
13+
if (!hasComponentRenderedOnce) {
14+
return null
15+
}
16+
717
const targetElement = document.getElementById('devtron-side-panel-actions')
818

919
if (!targetElement) {

0 commit comments

Comments
 (0)