Compare commits

...

3 Commits

Author SHA1 Message Date
codegen-sh[bot] 0c3d659a78 fix: Pass synthetic event to onDisclosureClick to prevent TypeError 2025-05-20 02:47:52 +00:00
codegen-sh[bot] 39e2053f7a fix: Update handleDisclosureClick to handle undefined events 2025-05-20 02:29:43 +00:00
codegen-sh[bot] 9fe130d7ea fix: Pass synthetic event to onDisclosureClick to prevent TypeError 2025-05-20 02:22:24 +00:00
2 changed files with 10 additions and 4 deletions
@@ -65,7 +65,13 @@ const CollectionLink: React.FC<Props> = ({
const handleExpand = React.useCallback(() => {
if (!expanded) {
onDisclosureClick();
// Create a synthetic event to pass to onDisclosureClick
const syntheticEvent = {
preventDefault: () => {},
stopPropagation: () => {},
} as React.MouseEvent<HTMLButtonElement>;
onDisclosureClick(syntheticEvent);
}
}, [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);
},
[]