Skip to content

Commit

Permalink
Use useLayoutEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed May 14, 2024
1 parent 034517e commit 013a769
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/dashboard/src/layouts/InfoMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function InfoMenu(props: InfoMenuProps) {
const { getText } = textProvider.useText()
const [initialized, setInitialized] = React.useState(false)

React.useEffect(() => {
React.useLayoutEffect(() => {
// Change the CSS from the initial state to the final state after the first render.
// This ensures that the CSS transition triggers.
setInitialized(true)
Expand Down
6 changes: 2 additions & 4 deletions app/ide-desktop/lib/dashboard/src/layouts/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ export default function UserMenu(props: UserMenuProps) {
const { getText } = textProvider.useText()
const toastAndLog = toastAndLogHooks.useToastAndLog()

React.useEffect(() => {
requestAnimationFrame(() => {
setInitialized(true)
})
React.useLayoutEffect(() => {
setInitialized(true)
}, [])

const aboutThisAppMenuEntry = (
Expand Down

0 comments on commit 013a769

Please sign in to comment.