Unmount "ReaderNavBarDesktop" on exit

Re-rendering the component isn't too expensive and unmounting it improves the re-rendering caused by page changes since it doesn't get updated.

This removes ~7ms on a "current page" state update and ~25ms caused by the chapter update due to the "last read page" change
This commit is contained in:
schroda
2024-12-29 17:12:24 +01:00
parent 94ee7d4958
commit 9438a2f626

View File

@@ -100,6 +100,9 @@ const BaseReaderNavBarDesktop = ({
variant={isStaticNav ? 'permanent' : 'persistent'}
open={isVisible || isStaticNav}
transitionDuration={drawerTransitionDuration}
SlideProps={{
unmountOnExit: true,
}}
PaperProps={{
ref: (ref: HTMLDivElement | null) => setNavBarElement(ref),
}}