Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Node level lifecycle hooks not always firing #165

Closed
Labels
@tropperstyle

Description

@tropperstyle

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp