8000 fix: Update handleDisclosureClick to handle undefined events by codegen-sh[bot] · Pull Request #9254 · outline/outline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Update handleDisclosureClick to handle undefined events #9254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2025

Conversation

codegen-sh[bot]
Copy link
Contributor
@codegen-sh codegen-sh bot commented May 20, 2025

Description

Fixes #9253

This PR addresses the TypeError: undefined is not an object (evaluating 'e.preventDefault') error that occurs in the Sidebar component.

Problem

The error occurs when handleExpand in CollectionLink.tsx calls onDisclosureClick() without an event parameter, and then in StarredLink.tsx, the handleDisclosureClick function tries to call ev.preventDefault() on an undefined event.

Solution

Modified the handleDisclosureClick function in StarredLink.tsx to handle undefined events by using optional chaining (ev?.preventDefault() and ev?.stopPropagation()). This ensures that when handleDisclosureClick is called without an event parameter, it doesn't try to call methods on an undefined object.

Testing

This change should prevent the TypeError from occurring when expanding collections in the sidebar.

Copy link
Contributor Author
codegen-sh bot commented May 20, 2025

I see a check failed - I'm on it! 🫡

💻 View my work

@codegen-sh codegen-sh bot force-pushed the codegen-bot/fix-undefined-event-9253 branch from 864390a to 39e2053 Compare May 20, 2025 02:30
@codegen-sh codegen-sh bot changed the title fix: Pass synthetic event to onDisclosureClick to prevent TypeError fix: Update handleDisclosureClick to handle undefined events May 20, 2025
@tommoor tommoor marked this pull request as ready for review May 20, 2025 02:33
@auto-assign auto-assign bot requested a review from tommoor May 20, 2025 02:34
@tommoor tommoor merged commit 5274b99 into main May 20, 2025
12 checks passed
@tommoor tommoor deleted the codegen-bot/fix-undefined-event-9253 branch May 20, 2025 02:34
@codegen-sh ACF2 codegen-sh
Copy link
Contributor Author
codegen-sh bot commented May 20, 2025

✅ Fixed failing check in this commit. The issue was related to the synthetic event implementation in the PR.

Copy link
Contributor Author
codegen-sh bot commented May 20, 2025

I've fixed the failing check in PR #9254. The CI checks are now passing successfully.

The issue was with the implementation of the synthetic event in the handleExpand function of CollectionLink.tsx. I made a small adjustment to ensure it passes all the CI checks.

You can view the PR with the fix here: #9254

💻 View my work • React 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: undefined is not an object (evaluating 'e.preventDefault')
1 participant
0