Drawer: remove unused soft unmount

This commit is contained in:
Enrico Ros
2025-06-15 11:09:51 -07:00
parent 407d3d8db4
commit e1dd9c0117
@@ -10,10 +10,6 @@ import { optimaCloseDrawer, optimaOpenDrawer, useOptimaDrawerOpen, useOptimaDraw
import { useOptimaPortalOutRef } from '../portals/useOptimaPortalOutRef';
// set to 0 to always keep the drawer mounted (smoother on/off)
const UNMOUNT_DELAY_MS = 0;
// Desktop Drawer
const DesktopDrawerFixRoot = styled(Box)({
@@ -86,28 +82,6 @@ export function DesktopDrawer(props: { component: React.ElementType, currentApp?
const isDrawerOpen = _isDrawerOpen || isDrawerPeeking;
// const hasDrawerContent = useOptimaPortalHasInputs('optima-portal-drawer');
// local state
const [_softDrawerUnmount, setSoftDrawerUnmount] = React.useState(false);
// 'soft unmount': remove contents after a delay
React.useEffect(() => {
if (!UNMOUNT_DELAY_MS)
return;
// drawer open: do not unmount
if (isDrawerOpen) {
setSoftDrawerUnmount(false);
return;
}
// drawer closed: delayed unmount
const unmountTimeoutId = setTimeout(() =>
setSoftDrawerUnmount(true)
, UNMOUNT_DELAY_MS);
return () => clearTimeout(unmountTimeoutId);
}, [isDrawerOpen]);
// Desktop-only?: close the drawer if the current app doesn't use it
const currentAppUsesDrawer = !props.currentApp?.hideDrawer;