Merge pull request #1435 from barneycarroll/document-equality-diff-skip

Document array semantics and vnode equality logic in migration guide
This commit is contained in:
Leo Horie 2016-11-29 08:35:37 -05:00 committed by GitHub
commit e9e3b8babb

View file

@ -17,6 +17,8 @@
- [Accessing route params](#accessing-route-params)
- [`m.request`](#mrequest)
- [`xlink` namespace required](#xlink-namespace-required)
- [Nested arrays in views](#nested-arrays-in-views)
- [Vnode equality checks](#vnode-equality-checks)
---
@ -243,7 +245,7 @@ m.mount(document.body, {
oninit : function(vnode) {
// ...
},
view : function(vnode) {
// Use vnode.state instead of ctrl
// Use vnode.attrs instead of options
@ -492,3 +494,15 @@ m("svg",
m("image[xlink:href='image.gif']")
)
```
***
## Nested arrays in views
Arrays now represent [fragments](fragments.md), which are structurally significant in v1.x virtual DOM. Whereas nested arrays in v0.2.x would be flattened into one continuous list of virtual nodes for the purposes of diffing, v1.x preserves the array structure - the children of any given array are not considered siblings of those of adjacent arrays.
***
## Vnode equality checks
If a vnode is strictly equal to the vnode occupying its place in the last draw, v1.x will skip that part of the tree without checking for mutations or triggering any lifecycle methods in the subtree. The component documentation contains [more detail on this issue](components.md#avoid-creating-component-instances-outside-views).