From 39e2053f7afcf0ab94de827a427c39263c664681 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 02:29:43 +0000 Subject: [PATCH] fix: Update handleDisclosureClick to handle undefined events --- app/components/Sidebar/components/CollectionLink.tsx | 8 +------- app/components/Sidebar/components/StarredLink.tsx | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/components/Sidebar/components/CollectionLink.tsx b/app/components/Sidebar/components/CollectionLink.tsx index ae0ba3d203..2a527746f5 100644 --- a/app/components/Sidebar/components/CollectionLink.tsx +++ b/app/components/Sidebar/components/CollectionLink.tsx @@ -65,13 +65,7 @@ const CollectionLink: React.FC = ({ const handleExpand = React.useCallback(() => { if (!expanded) { - // Create a synthetic event to pass to onDisclosureClick - const syntheticEvent = { - preventDefault: () => {}, - stopPropagation: () => {}, - } as React.MouseEvent; - - onDisclosureClick(syntheticEvent); + onDisclosureClick(); } }, [expanded, onDisclosureClick]); diff --git a/app/components/Sidebar/components/StarredLink.tsx b/app/components/Sidebar/components/StarredLink.tsx index be0fc7645d..f89706b9f0 100644 --- a/app/components/Sidebar/components/StarredLink.tsx +++ b/app/components/Sidebar/components/StarredLink.tsx @@ -78,9 +78,9 @@ function StarredLink({ star }: Props) { }, [documentId, documents]); const handleDisclosureClick = React.useCallback( - (ev: React.MouseEvent) => { - ev.preventDefault(); - ev.stopPropagation(); + (ev?: React.MouseEvent) => { + ev?.preventDefault(); + ev?.stopPropagation(); setExpanded((prevExpanded) => !prevExpanded); }, []