mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-27 13:48:52 +02:00
Switch from useEffect
to useLayoutEffect
in the RootPortal
component. (#1120)
Co-authored-by: Harshil Sharma <harshilsharma63@gmail.com>
This commit is contained in:
parent
704454ab69
commit
1a007754b3
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {useState, useEffect} from 'react'
|
||||
import React, {useState, useLayoutEffect} from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
|
||||
type Props = {
|
||||
@ -12,7 +12,7 @@ const RootPortal = React.memo((props: Props): JSX.Element => {
|
||||
const [el] = useState(document.createElement('div'))
|
||||
const rootPortal = document.getElementById('focalboard-root-portal')
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
if (rootPortal) {
|
||||
rootPortal.appendChild(el)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user