-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reentrant event listeners #3037
Conversation
Visit the preview URL for this PR (updated for commit ceeb3ca): https://yew-rs-api--pr3037-reentrent-listeners-wp0miw5c.web.app (expires Sun, 18 Dec 2022 19:58:51 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recursively calling FnMut
should not compile if it is pure Rust, but we do not use captured mutable reference internally and Callback is also Fn
. Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would've preferred to have this solved in gloo but I ran into some issues when I tried to do that. This PR looks good to me
There's something I was experimenting with, not sure how ties with here: moving the event listeners registration to JS. Instead of a Rust hash map storing the listeners and calling them, a JavaScript object will. I haven't benchmarked anything and don't have anything concrete enough to turn into a PR; just a thought I had.
* add test case for reentrent event listeners * use Fn to allow reentrent event listeners
* add test case for reentrent event listeners * use Fn to allow reentrent event listeners
Description
Fixes #2989 and allows for listeners to trigger events that will reenter yew's event handling (which might trigger further event handlers or exit early).
Checklist