Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit f2ffabe

Browse files
committed
Refined VNode comparison for better exists.
1. Created new property on container: previousVNode. This contains a clone of the previous VNode before patching. This means its element properties all have null values, same as a newly provided VNode would. 2. The patchElement function in vdom.js now check the container's previousVNode property to check with the provided VNode from render. If the two objects are identical, it exists. Before this didn't happen because the default vnode property on the container has references to DOM elements from the last patch.
1 parent 1fddf9c commit f2ffabe

11 files changed

+20
-7
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# composi/core Changelog
22

3+
## 1.6.1 (June 7, 2019)
4+
5+
### src/render.js
6+
* Now taking the VNode passed as an argument to the render function and clone it to save on the component container element as the value of property `previousVNode`.
7+
8+
### src/vdom.js
9+
* Now the `patchElement` function checks the new `previousVNode` property on the parent element to see if the new VNode is identical to the older vision. If they are it exits the patch immediately. Previously, the diff was checking a plain VNode against one which resulted from patching. Problem was, patching made the saved VNode always have DOM values for element, where as a fresh VNode has elements with a value of null. Using `previousVNode` allows the diff to check the resulting new VNode with the previous version before patching adds elements. This allows for quick exiting from the diff if there are no differences.
10+
11+
The save VNode in the `vnode` property of the continer is still used for patching, since it holds the last DOM render information.
12+
313
## 1.6.0 (June 5, 2019)
414

515
### src/vdom.js

dist/composi-core.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/composi-core.js.gz

29 Bytes
Binary file not shown.

dist/composi-core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)