Skip to content

Commit

Permalink
[docs-infra] Fix drawer performances (mui#41807)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Apr 9, 2024
1 parent fc95e40 commit 76f7a5d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/src/modules/components/AppFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ export default function AppFrame(props) {
const [mobileOpen, setMobileOpen] = React.useState(false);
const [settingsOpen, setSettingsOpen] = React.useState(false);

const closeDrawer = React.useCallback(() => setMobileOpen(false), []);
const openDrawer = React.useCallback(() => setMobileOpen(true), []);

const { activePage } = React.useContext(PageContext);

const disablePermanent = activePage?.disableDrawer === true || disableDrawer === true;
Expand Down Expand Up @@ -230,8 +233,8 @@ export default function AppFrame(props) {
</StyledAppBar>
<StyledAppNavDrawer
disablePermanent={disablePermanent}
onClose={() => setMobileOpen(false)}
onOpen={() => setMobileOpen(true)}
onClose={closeDrawer}
onOpen={openDrawer}
mobileOpen={mobileOpen}
/>
{children}
Expand Down

0 comments on commit 76f7a5d

Please sign in to comment.