fix(ui): make invoketabs not lazy

This commit is contained in:
psychedelicious 2023-03-19 18:44:28 +11:00
parent 2aefa06ef1
commit 35f6b5d562
2 changed files with 1 additions and 16 deletions

View File

@ -166,20 +166,8 @@ export default function InvokeTabs() {
[] []
); );
/**
* isLazy means the tabs are mounted and unmounted when changing them. There is a tradeoff here,
* as mounting is expensive, but so is retaining all tabs in the DOM at all times.
*
* Removing isLazy messes with the outside click watcher, which is used by ResizableDrawer.
* Because you have multiple handlers listening for an outside click, any click anywhere triggers
* the watcher for the hidden drawers, closing the open drawer.
*
* TODO: Add logic to the `useOutsideClick` in ResizableDrawer to enable it only for the active
* tab's drawer.
*/
return ( return (
<Tabs <Tabs
isLazy
defaultIndex={activeTab} defaultIndex={activeTab}
index={activeTab} index={activeTab}
onChange={(index: number) => { onChange={(index: number) => {

View File

@ -93,12 +93,9 @@ const ResizableDrawer = ({
useOutsideClick({ useOutsideClick({
ref: outsideClickRef, ref: outsideClickRef,
handler: () => { handler: () => {
if (isPinned) {
return;
}
onClose(); onClose();
}, },
enabled: isOpen && !isPinned,
}); });
const handleEnables = useMemo( const handleEnables = useMemo(