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
Next Steps #195
Comments
I am not sure I understand the problem very well, but could the hooks be invoked for logical "net result" operations. So if the net result was to take [1,2,3,4] and end up with [4,1,2,3] that would be one remove for 4 and one reinsert for 4, not (logically) passing through [1,2,4,3] and [1,4,2,3] on the way. |
the current reconciler will do the correct/optimal thing in pretty much all cases. in your example it will only do willReinsert(4)/didReinsert(4) in both actual dom ops and hooks (which are fired by dom ops). one problem this issue addresses is when you have hooks on fragments or other vtree components like immediately nested views or views returning null from render that will not or cannot exist in the dom. since the current reconciler walks the real old dom, it never encounters vnodes that dont have a physical dom presence. this is why you currently cant have views that directly return other views, fragments or have render functions that return null while still retaining the stateful/declarative component in the vtree despite removal from dom. if we walk the old vtree in the reconciler, then a lot of this stuff becomes possible and delivers on some additional benefits of maintaining a vdom rather than being partly or purely dom-based #196 ;) |
It seems like (1) reconciling against the old vDOM is sensible to do regardless and would make DOMVM immune to in-hook DOM manipulation. I wonder if fragments might be doable then by using a special psuedo-tag, say, "domvm-fragment", which when processed by the hydrator would simply be ignored, inserting the children instead?
Just an idea to chew on. |
@leeoniya : I suggest enabling discussions and moving this to a discussion. |
Now that we have CSS I think the only gotcha is that CSS immediate child selectors are sensitive to the intervening node so
|
@leeoniya : Should we close this as unneeded due to support for display contents and subgrid (landing this year)? |
the current dom insertion/removal/reordering reconciler [1] relies on 1:1 vnode-to-element mapping. this design prevents proper implementation of fragment vnodes, which in turn forces all views to return a single
defineElement()
vnode.to resolve this impasse the reconciler must be:
[1] https://github.com/leeoniya/domvm/blob/3.x-dev/src/view/syncChildren.js
[2] https://codepen.io/anon/pen/zpdRKQ?editors=1000
The text was updated successfully, but these errors were encountered: