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:
@@ -100,6 +100,9 @@ const BaseReaderNavBarDesktop = ({
|
|||||||
variant={isStaticNav ? 'permanent' : 'persistent'}
|
variant={isStaticNav ? 'permanent' : 'persistent'}
|
||||||
open={isVisible || isStaticNav}
|
open={isVisible || isStaticNav}
|
||||||
transitionDuration={drawerTransitionDuration}
|
transitionDuration={drawerTransitionDuration}
|
||||||
|
SlideProps={{
|
||||||
|
unmountOnExit: true,
|
||||||
|
}}
|
||||||
PaperProps={{
|
PaperProps={{
|
||||||
ref: (ref: HTMLDivElement | null) => setNavBarElement(ref),
|
ref: (ref: HTMLDivElement | null) => setNavBarElement(ref),
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user