You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired #807
Calling .off(eventName, handler) for a handler that was registered with .once() and has already auto-fired throws (or silently no-ops incorrectly) because the internal once-wrapper function reference doesn't match what the caller passed to .off().
Component
core
Steps to Reproduce
Register a handler via .once('escrow:funded', handler).
Let the event fire once (auto-removing the once-listener internally).
Call .off('escrow:funded', handler) afterward (e.g. in a cleanup effect).
Expected Behavior
Calling .off() with the original handler reference after a .once() listener has already fired should be a safe no-op, not an error.
Actual Behavior
This throws or behaves unexpectedly because the internally-wrapped once-handler (a different function reference) is what's actually tracked, not the original handler passed by the caller.
Environment
SDK version: 0.3.x
Node version: 20.x, 22.x
OS: macOS / Linux
Network: TESTNET
Code Example
// Not applicable — reproduced via API inspection, not a standalone snippet.
Error Output
N/A — no thrown error; behavior is incorrect but silent.
Difficulty
🟢 Easy
Additional Context
The .once() implementation wraps the handler in an auto-removing closure but doesn't maintain a mapping back to the original handler reference for later .off() calls.
I reviewed the issue for events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired. We need to resolve 'events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired' cleanly across the target modules.
Proposed Implementation:
Trace the current code execution path in off() to isolate the behavior boundary.
Implement a focused, modular fix for 'events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired' adhering strictly to repository architecture.
Ensure defensive guards and backward compatibility are maintained.
Testing & Verification:
I will reproduce the target scenario locally, add regression unit tests, and confirm all CI checks pass 100% green.
Ready to implement the patch today once assigned. Thanks!
I looked into the details for "[BUG] events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired" and would like to contribute the fix.
I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.
I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.
Activity
GangDev6707 commentedon Nov 6, 2026
Hi maintainers,
I reviewed the issue for events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired. We need to resolve 'events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired' cleanly across the target modules.
Proposed Implementation:
off()to isolate the behavior boundary.Testing & Verification:
I will reproduce the target scenario locally, add regression unit tests, and confirm all CI checks pass 100% green.
Ready to implement the patch today once assigned. Thanks!
shobhamerabacha-star commentedon Nov 17, 2026
Greetings,
I looked into the details for "[BUG] events.ts event emitter's off() method doesn't actually remove a listener if it was registered via the once() helper and already fired" and would like to contribute the fix.
I have reviewed the problem description and acceptance criteria for this issue. I have a clear, tested implementation ready with defensive error handling and 100% green CI proof.
I will deliver a clean, well-tested, and production-ready PR promptly upon assignment. Kindly assign this issue to me.
Thank you!