Skip to content

[Bug] TypeError: Cannot read properties of undefined (reading 'addEventListener') on repository homepage #999

@yankay

Description

@yankay

Version

1.9.22

Current Behavior

Visiting https://github.com/hypertrons/hypertrons-crx always triggers a browser console error:

contentScript.bundle.js:404 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'addEventListener')
at contentScript.bundle.js:404:185244
...(stack trace omitted)...

Preliminary investigation indicates it is likely related to src/pages/ContentScripts/components/NativePopover.tsx, where anchor[0] or $popoverContainer[0] is not properly checked before using .addEventListener.

After ✅ hypercrx-repo-pr-tooltip logs in console, the error occurs, which suggests it is related to the repo-pr-tooltip feature initializing the popover.

Expected Behavior

The page should load normally without any JavaScript console errors. Popover initialization should not throw errors even if anchor elements are missing.

Environment

- OS: Windows 10/11
- Browser: Chrome 145.0.7632.75 (64-bit)
- HyperCRX version: 1.9.22

Any additional comments?

This issue is 100% reproducible. It occurs every time on the repository homepage, regardless of page refresh or direct entry.

Please check the logic in repo-pr-tooltip/NativePopover, especially guard clauses before attaching event listeners to anchor or target elements. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategory issues or prs related to bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions