Skip to content

Commit

Permalink
fix: poor INP when opening drawer for the first time
Browse files Browse the repository at this point in the history
  • Loading branch information
iago1501 committed Nov 13, 2024
1 parent 0ec8c5f commit 8cb5c01
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions react/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,17 @@ function Drawer(props: Props) {
)

const overlayVisible = backdropMode === 'visible' && isMenuOpen

useEffect(() => {
if (isMenuOpen || hasMenuBeenOpened || renderingStrategy === 'eager'){
if (isMenuOpen || hasMenuBeenOpened || renderingStrategy === 'eager') {
setShouldRenderChildren(true)
}
},
[hasMenuBeenOpened, renderingStrategy, setShouldRenderChildren, isMenuOpen])
},[

Check failure on line 195 in react/Drawer.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `·`
hasMenuBeenOpened,
renderingStrategy,
setShouldRenderChildren,
isMenuOpen

Check failure on line 199 in react/Drawer.tsx

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
])

return (
<DrawerContextProvider value={contextValue}>
Expand Down

0 comments on commit 8cb5c01

Please sign in to comment.