1
0
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:
kamre 2021-09-06 19:17:10 +07:00 committed by GitHub
parent 704454ab69
commit 1a007754b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}