fix(v2): preserve listener removal during event dispatch#5218
fix(v2): preserve listener removal during event dispatch#5218leaanthony wants to merge 1 commit intomasterfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
When a listener was removed during its own callback (via the cancel function returned by EventsOn), notifyListeners would restore it because it replaced eventListeners[eventName] with a snapshot taken before the callbacks ran. Fix by operating on the live listener list directly and checking if each listener still exists before invoking its callback. Fixes #4393
e74901a to
fd8da51
Compare
|
🤖 PR Triage Review ✅ Accepted Preserves listener removal during event dispatch (v2 runtime). Fixes event management bug. Platform: All (v2, runtime) Next Steps: Dispatching for testing on all platforms. Reviewed by Wails PR Reviewer Bot |
Summary
EventsOff) had no effect becausenotifyListenersoverwroteeventListeners[eventName]with a stale snapshot taken before callbacks ranTest plan
EventsOffduring a callback stay removed on subsequent eventsFixes #4393