Skip to content

Conversation

yslpn
Copy link
Contributor

@yslpn yslpn commented Jul 2, 2025

Description

  1. I expect that the same function will not be added twice. To fix this, I switched from arrays to Set.
  2. Ensures that the event invocation cycle will not be broken if the handlers themselves start changing the list of listeners. For example, adding or removing.

Types of changes

Refactored EventEmitter + add two new tests

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

Copy link

vercel bot commented Jul 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview Jul 12, 2025 1:22pm

Copy link

codecov bot commented Jul 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.81%. Comparing base (6bb8983) to head (0c9c13e).
Report is 202 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2277      +/-   ##
==========================================
- Coverage   77.05%   76.81%   -0.24%     
==========================================
  Files          84       89       +5     
  Lines        2157     2497     +340     
  Branches      555      648      +93     
==========================================
+ Hits         1662     1918     +256     
- Misses        382      463      +81     
- Partials      113      116       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@vonovak vonovak left a comment

Choose a reason for hiding this comment

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

Hello and thanks for the PR!

Firstly, may I ask what's the motivation for the PR?

I'd say it can be merged, but for v6 - the change of behavior, while subtle, is a breaking change. Also the removal of removeListener is a breaking change - it should be added back.

Thank you :)

@yslpn
Copy link
Contributor Author

yslpn commented Jul 12, 2025

Hello and thanks for the PR!

Firstly, may I ask what's the motivation for the PR?

I'd say it can be merged, but for v6 - the change of behavior, while subtle, is a breaking change. Also the removal of removeListener is a breaking change - it should be added back.

Thank you :)

Hi, I noticed this behavior when experimenting with my own implementations in React. I think this behavior improves stability, even in the worst case.

I think this change can be merged into version 6. Not urgent.

@andrii-bodnar andrii-bodnar marked this pull request as draft July 17, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants