-
-
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
Await resolution of subtree's onbeforeremoves
before removal
#1184
Await resolution of subtree's onbeforeremoves
before removal
#1184
Conversation
Wouldn't this worsen the already less than ideal remove perf? |
Yeah, that's a point! I think the practical edge cases of why this doesn't "just work" the way I described in #1182 are only just sinking in: without time travel, you need every node liable to removal to reiterate through its entire subtree to check for removal conditions. With the current patch, in order to meet my aims, that would require the author to declare an @pygy you raise the good point that this introduces potential for authors to significantly screw the potential preformance of the draw lifecycle, because as I've just worked out, you introduce the potential for any number of concentric re-traversals of the subtree in order to determine potential removal dependencies. IMO this isn't (currently) a serious concern because traversing a vnode tree is both trivial / orthogonal to the concerns of modern animation techniques. I'd just like to take a break in this wall of text to insist that a decent API for outgoing animations is an incredibly worthwhile thing. It was part and parcel of web apps before MVC took over the world and we are throwing user gratification and application possibility space to the wind if we say that this isn't worthy of our concern even in the face of implementation and API design trickiness. So let's look at our options:
// I *know* I'm subject to removal
export default const Modal = {
onbeforeremove : ( {}, done ) =>
done(),
view : ( { children } ) =>
m( '.Modal',
m( '.barrier', {
onbeforeremove : x
} ),
m( '.content', {
onbeforeremove : x
},
children
)
)
}
|
@barneycarroll check this out :-) AFAICT you can tick the second item of your list. Somehow github won't let me send you a PR... I've rebased this on top of the current head, feel free to pull it from my fork to push it in yours :-) |
Ooooh... I hadn't seen the gitter discussion... in light of this, my addition may be misguided. The way you implemented it, if the first hook calls Otherwise, we may rely on calling Edit: actulally, no, I need to sleep... That won't help. You'd need to build a tree of callbacks first, then traverse it and optionally skipping the children using either |
After playing around with this patterns use case and implementation strategies on and off for a while, I think it's reasonable to close this:
I've opened #1486 to deal with the Promise proposal which arose as a tangent. |
As described in #1182
onbeforeremoves