mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
fix: Update handleDisclosureClick to handle undefined events
This commit is contained in:
1 parent
9fe130d7ea
commit
39e2053f7a
2 files changed
+4
-10
No files matched your search
@@ -65,13 +65,7 @@ const CollectionLink: React.FC<Props> = ({
|
||||
|
||||
const handleExpand = React.useCallback(() => {
|
||||
if (!expanded) {
|
||||
// Create a synthetic event to pass to onDisclosureClick
|
||||
const syntheticEvent = {
|
||||
preventDefault: () => {},
|
||||
stopPropagation: () => {},
|
||||
} as React.MouseEvent<HTMLButtonElement>;
|
||||
|
||||
onDisclosureClick(syntheticEvent);
|
||||
onDisclosureClick();
|
||||
}
|
||||
}, [expanded, onDisclosureClick]);
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ function StarredLink({ star }: Props) {
|
||||
}, [documentId, documents]);
|
||||
|
||||
const handleDisclosureClick = React.useCallback(
|
||||
(ev: React.MouseEvent<HTMLButtonElement>) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
(ev?: React.MouseEvent<HTMLButtonElement>) => {
|
||||
ev?.preventDefault();
|
||||
ev?.stopPropagation();
|
||||
setExpanded((prevExpanded) => !prevExpanded);
|
||||
},
|
||||
[]
|
||||
|
||||
Reference in new issue
Block a user