- Notifications
You must be signed in to change notification settings - Fork27
Closed
Labels
Description
Is there any guarantee that a node'swillInsert
hook will be called? I have a scenario where an element ends up in the dom without firingany lifecycle hooks. On a later redraw,willRecycle
is finally the first hook to fire.
el('div.some-class',{_hooks:{willInsert:function(node){console.log("willInsert",node);},willRecycle:function(oldNode,newNode){console.log("willRecycle",oldNode,newNode);},willReinsert:function(node){console.log("willReinsert",node);},willRemove:function(node){console.log("willRemove",node);}}})
I also have another scenario that sometimes barfs becausenode.dropdown === null
indidRemove
:
el('div.phone-input',{_hooks:{didInsert(node){node.dropdown=newCountryDropdown();},willRecycle(oldNode,newNode){newNode.dropdown=oldNode.dropdown;},didRemove(node){node.dropdown.destroy();}}})
I'm guessing these mismatches are due to the dom element pooling. I tried adding_key
without luck. Maybe I am missing something. Is a sub-view required to encapsulate this type of life-cycle?