fix: filemanager state handling (#232)
* fix: filemanager state handling * refactor: fm provider and fm page * fix: detect bee warmup and wait more for syncing * refactor: optimize bee provider to avoid rerenders --------- Co-authored-by: Roland Seres <roland.seres90@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { ReactElement } from 'react'
|
||||
import React, { ReactElement, useLayoutEffect, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
|
||||
import { Button } from '../Button/Button'
|
||||
@@ -35,7 +35,11 @@ export function ConfirmModal({
|
||||
onMinimize,
|
||||
background = true,
|
||||
}: ConfirmModalProps): ReactElement {
|
||||
const modalRoot = document.querySelector('.fm-main') || document.body
|
||||
const [modalRoot, setModalRoot] = useState<Element>(() => document.querySelector('.fm-main') || document.body)
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setModalRoot(document.querySelector('.fm-main') || document.body)
|
||||
}, [])
|
||||
|
||||
return createPortal(
|
||||
<div className={`fm-modal-container fm-confirm-modal ${background ? '' : 'fm-modal-no-background'}`}>
|
||||
|
||||
Reference in New Issue
Block a user