-
-
Notifications
You must be signed in to change notification settings - Fork 924
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
onremove
called multiple times for elements taken from recycle pool
#1990
Comments
@purplecode thanks for the report, I need to think about this a bit more (and it's getting late here). I have a pending patch that fixes other issues with the pool and that introduces a boolean flag ( That flag is Not sure if we can also use it for that purpose... I don't know the intricacies of |
@purplecode I think we can solve this by adding It fixes your repro (I've patched Mithril accordingly in that Flems), but I'll have to review the various branches to make sure it covers all bases. |
…rom pool to pool (fix MithrilJS#1990)
…rom pool to pool (fix MithrilJS#1990)
…t move from pool to pool (fix MithrilJS#1990)
…t move from pool to pool (fix MithrilJS#1990)
…t move from pool to pool (fix MithrilJS#1990)
…t move from pool to pool (fix MithrilJS#1990)
Expected Behavior
onremove
should be called only once after everyoncreate
Current Behavior
onremove
can be called multiple times for recycled elements. Every time when element is withdrawn from recycle pool: https://github.com/MithrilJS/mithril.js/blob/next/render/render.js#L188-L190it is added to old list of elements without any special treatment. In case when it is not used for the second time, the
onremove
is fired again.Possible Solution
Add a flag to recycled elements, that would allow for special treatment in case when they were taken from recycle pool, but not used.
Steps to Reproduce (for bugs)
As in the code snippet.
Context
I have to set in
state
a flag that indicates that the element is removed for the first time afteroncreate
. I'd rather see that as a part of library.Your Environment
The text was updated successfully, but these errors were encountered: