Skip to content

Commit a449ecd

Browse files
authored
ENG-947 dragging and/or clicking on section header crashes the sidebar (#481)
* remove open target call for personal section header * fix useconfig hook, fix overflow-scroll bug in left sidebar view * fix overflow-scroll bug in left sidebar view
1 parent 6a76a03 commit a449ecd

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

apps/roam/src/components/LeftSidebarView.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,9 @@ const PersonalSectionItem = ({
218218
<div className="flex w-full items-center justify-between">
219219
<div
220220
className="flex items-center"
221-
onClick={(e: React.MouseEvent) => {
221+
onClick={() => {
222222
if ((section.children?.length || 0) > 0) {
223223
handleChevronClick();
224-
} else {
225-
void openTarget(e, section.text);
226224
}
227225
}}
228226
>
@@ -452,7 +450,7 @@ export const useConfig = () => {
452450
unsubscribe();
453451
};
454452
}, []);
455-
return config;
453+
return { config, setConfig };
456454
};
457455

458456
export const refreshAndNotify = () => {
@@ -572,8 +570,8 @@ const FavouritesPopover = ({ onloadArgs }: { onloadArgs: OnloadArgs }) => {
572570
};
573571

574572
const LeftSidebarView = ({ onloadArgs }: { onloadArgs: OnloadArgs }) => {
575-
const initialConfig = useConfig();
576-
const [config, setConfig] = useState(initialConfig);
573+
const { config, setConfig } = useConfig();
574+
577575
return (
578576
<>
579577
<FavouritesPopover onloadArgs={onloadArgs} />
@@ -599,11 +597,11 @@ export const mountLeftSidebar = (
599597
}
600598
root = document.createElement("div");
601599
root.id = id;
602-
root.className = "starred-pages overflow-scroll";
600+
root.className = "starred-pages";
603601
root.onmousedown = (e) => e.stopPropagation();
604602
wrapper.appendChild(root);
605603
} else {
606-
root.className = "starred-pages overflow-scroll";
604+
root.className = "starred-pages";
607605
}
608606
ReactDOM.render(<LeftSidebarView onloadArgs={onloadArgs} />, root);
609607
};

0 commit comments

Comments
 (0)