mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Add setTimeout to fix the bug
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { useEffect } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { Outlet } from 'react-router-dom'
|
import { Outlet } from 'react-router-dom'
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })(({
|
|||||||
|
|
||||||
const MainLayout = () => {
|
const MainLayout = () => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
const matchDownMd = useMediaQuery(theme.breakpoints.down('lg'))
|
||||||
|
|
||||||
// Handle left drawer
|
// Handle left drawer
|
||||||
const leftDrawerOpened = useSelector((state) => state.customization.opened)
|
const leftDrawerOpened = useSelector((state) => state.customization.opened)
|
||||||
@@ -67,6 +69,11 @@ const MainLayout = () => {
|
|||||||
dispatch({ type: SET_MENU, opened: !leftDrawerOpened })
|
dispatch({ type: SET_MENU, opened: !leftDrawerOpened })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => dispatch({ type: SET_MENU, opened: !matchDownMd }), 0)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [matchDownMd])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ display: 'flex' }}>
|
<Box sx={{ display: 'flex' }}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
|
|||||||
Reference in New Issue
Block a user