Skip to content

Fix removeEventListener missing options in LifeCycle#363

Merged
brianmhunt merged 1 commit into
mainfrom
fix/lifecycle-remove-event-listener-options
Apr 27, 2026
Merged

Fix removeEventListener missing options in LifeCycle#363
brianmhunt merged 1 commit into
mainfrom
fix/lifecycle-remove-event-listener-options

Conversation

@phillipc
Copy link
Copy Markdown
Member

Problem

LifeCycle.__addEventListener registers listeners with addEventListener(type, handler, options) but disposes them with removeEventListener(type, handler) — without passing options.

Per the DOM spec, removeEventListener must match the capture flag used during registration. Without it, capture-phase listeners remain attached after disposal, leaking event handlers.

Fix

Pass options through to removeEventListener in the dispose callback.

Test

Added a test that registers a capture-phase listener, verifies it fires, disposes the LifeCycle, and confirms the listener no longer fires.

Pass options (including capture) to removeEventListener so that
capture-phase listeners are properly removed on disposal.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Warning

Rate limit exceeded

@phillipc has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 43 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 26 minutes and 43 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24c88e4c-2008-4517-96ca-3ff340b1d1d3

📥 Commits

Reviewing files that changed from the base of the PR and between f670aa8 and 525d97d.

📒 Files selected for processing (2)
  • packages/lifecycle/spec/LifeCycleBehaviors.ts
  • packages/lifecycle/src/LifeCycle.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lifecycle-remove-event-listener-options

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@brianmhunt brianmhunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @phillipc

@brianmhunt brianmhunt merged commit bca1372 into main Apr 27, 2026
9 checks passed
@brianmhunt brianmhunt deleted the fix/lifecycle-remove-event-listener-options branch April 27, 2026 12:48
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.

2 participants