Matt-Esch / virtual-dom

A Virtual DOM and diffing algorithm
MIT License
11.67k stars 777 forks source link

how to have a VNode force a DOM update (vNode structure is not in sync. with actual DOM) #425

Closed brucou closed 5 years ago

brucou commented 7 years ago

I encountered a use case where the vTree/vNodes are desynchronized from the actual DOM. This plays badly with the diffing/update mechanism, as from the snabbdom point of view, nothing has changed, while the DOM indeed changed. In this case (which I can detect), I would like to force the DOM to update to reflect the vTree, that is unplug the diffing algorithm for that specific vTree.

Is there an easy way to do this?

I tried using key as in

    ? {
      key : latestTeamIndex,
      props: {
        value: fieldValue,
        type: 'text',
        required: false,
      }
    }

thinking that would be enough for the library to understand that that vNode is different from another vNode with the same data (hence it should update the DOM instead of doing nothing) but that seems to fail.

brucou commented 5 years ago

that looks seriously unmaintained so I have stopped using it, so I am closing this