mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Refractor
This commit is contained in:
@@ -16,14 +16,13 @@ const Sidebar: FC<SidebarProps> = ({ children, onClose }) => {
|
||||
const ref = useRef() as React.MutableRefObject<HTMLDivElement>
|
||||
|
||||
useEffect(() => {
|
||||
const sidebar = ref.current
|
||||
|
||||
if (sidebar) {
|
||||
disableBodyScroll(sidebar, { reserveScrollBarGap: true })
|
||||
if (ref.current) {
|
||||
disableBodyScroll(ref.current, { reserveScrollBarGap: true })
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (sidebar) enableBodyScroll(sidebar)
|
||||
if (ref && ref.current) {
|
||||
enableBodyScroll(ref.current)
|
||||
}
|
||||
clearAllBodyScrollLocks()
|
||||
}
|
||||
}, [])
|
||||
|
Reference in New Issue
Block a user