fix: Update handleDisclosureClick to handle undefined events

This commit is contained in:
codegen-sh[bot] committed 2025-05-20 02:29:43 +00:00
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);
},
[]