diff --git a/src/shared/index.js b/src/shared/index.js
index 47e7a75099..4229da3d3e 100644
--- a/src/shared/index.js
+++ b/src/shared/index.js
@@ -107,7 +107,7 @@ export function set(newState) {
flush(this.root);
}
-export function _set(newState) {
+export function _set(newState, options) {
var oldState = this._state,
changed = {},
dirty = false;
@@ -115,9 +115,22 @@ export function _set(newState) {
for (var key in newState) {
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
- if (!dirty) return;
+ if (!dirty && !this._changed) return false;
this._state = assign(assign({}, oldState), newState);
+
+ if (options && options.skipRender) {
+ if (!this._oldState) this._oldState = oldState;
+ this._changed = assign(changed, this._changed);
+ return true;
+ }
+
+ if (this._changed) {
+ oldState = this._oldState;
+ changed = assign(changed, this._changed),
+ this._changed = this._oldState = null;
+ }
+
this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state);
@@ -126,6 +139,7 @@ export function _set(newState) {
this._fragment.p(changed, this._state);
this.fire("update", { changed: changed, current: this._state, previous: oldState });
}
+ return true;
}
export function setDev(newState) {
diff --git a/store.js b/store.js
index 29ea7d5ec1..cc97eddb8a 100644
--- a/store.js
+++ b/store.js
@@ -61,8 +61,9 @@ assign(Store.prototype, {
});
const dependents = this._dependents.slice(); // guard against mutations
- for (let i = 0; i < dependents.length; i += 1) {
- const dependent = dependents[i];
+ const options = { skipRender: true };
+ const empty = {};
+ const dirtyDependents = dependents.filter(dependent => {
const componentState = {};
let dirty = false;
@@ -74,8 +75,12 @@ assign(Store.prototype, {
}
}
- if (dirty) dependent.component.set(componentState);
- }
+ if (dirty) {
+ return dependent.component._set(componentState, options);
+ }
+ });
+
+ dirtyDependents.forEach(dependent => dependent.component.set(empty));
this.fire('update', {
changed,
diff --git a/test/cli/samples/amd/expected/Main.js b/test/cli/samples/amd/expected/Main.js
index 35f4b57186..bbdc8c40de 100644
--- a/test/cli/samples/amd/expected/Main.js
+++ b/test/cli/samples/amd/expected/Main.js
@@ -135,7 +135,7 @@ define("test", function() { "use strict";
flush(this.root);
}
- function _set(newState) {
+ function _set(newState, options) {
var oldState = this._state,
changed = {},
dirty = false;
@@ -143,9 +143,22 @@ define("test", function() { "use strict";
for (var key in newState) {
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
- if (!dirty) return;
+ if (!dirty && !this._changed) return false;
this._state = assign(assign({}, oldState), newState);
+
+ if (options && options.skipRender) {
+ if (!this._oldState) this._oldState = oldState;
+ this._changed = assign(changed, this._changed);
+ return true;
+ }
+
+ if (this._changed) {
+ oldState = this._oldState;
+ changed = assign(changed, this._changed),
+ this._changed = this._oldState = null;
+ }
+
this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state);
@@ -154,6 +167,7 @@ define("test", function() { "use strict";
this._fragment.p(changed, this._state);
this.fire("update", { changed: changed, current: this._state, previous: oldState });
}
+ return true;
}
function _mount(target, anchor) {
diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js
index 7d24fd3862..a2184f1082 100644
--- a/test/cli/samples/basic/expected/Main.js
+++ b/test/cli/samples/basic/expected/Main.js
@@ -135,7 +135,7 @@ function set(newState) {
flush(this.root);
}
-function _set(newState) {
+function _set(newState, options) {
var oldState = this._state,
changed = {},
dirty = false;
@@ -143,9 +143,22 @@ function _set(newState) {
for (var key in newState) {
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
- if (!dirty) return;
+ if (!dirty && !this._changed) return false;
this._state = assign(assign({}, oldState), newState);
+
+ if (options && options.skipRender) {
+ if (!this._oldState) this._oldState = oldState;
+ this._changed = assign(changed, this._changed);
+ return true;
+ }
+
+ if (this._changed) {
+ oldState = this._oldState;
+ changed = assign(changed, this._changed),
+ this._changed = this._oldState = null;
+ }
+
this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state);
@@ -154,6 +167,7 @@ function _set(newState) {
this._fragment.p(changed, this._state);
this.fire("update", { changed: changed, current: this._state, previous: oldState });
}
+ return true;
}
function _mount(target, anchor) {
diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js
index 1d34cc12a6..dc26df5ccb 100644
--- a/test/cli/samples/custom-element/expected/Main.js
+++ b/test/cli/samples/custom-element/expected/Main.js
@@ -156,7 +156,7 @@ function set(newState) {
flush(this.root);
}
-function _set(newState) {
+function _set(newState, options) {
var oldState = this._state,
changed = {},
dirty = false;
@@ -164,9 +164,22 @@ function _set(newState) {
for (var key in newState) {
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
- if (!dirty) return;
+ if (!dirty && !this._changed) return false;
this._state = assign(assign({}, oldState), newState);
+
+ if (options && options.skipRender) {
+ if (!this._oldState) this._oldState = oldState;
+ this._changed = assign(changed, this._changed);
+ return true;
+ }
+
+ if (this._changed) {
+ oldState = this._oldState;
+ changed = assign(changed, this._changed),
+ this._changed = this._oldState = null;
+ }
+
this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state);
@@ -175,6 +188,7 @@ function _set(newState) {
this._fragment.p(changed, this._state);
this.fire("update", { changed: changed, current: this._state, previous: oldState });
}
+ return true;
}
function _mount(target, anchor) {
diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js
index e32ea9a61e..02c90d3ec6 100644
--- a/test/cli/samples/dev/expected/Main.js
+++ b/test/cli/samples/dev/expected/Main.js
@@ -161,7 +161,7 @@ function setDev(newState) {
set.call(this, newState);
}
-function _set(newState) {
+function _set(newState, options) {
var oldState = this._state,
changed = {},
dirty = false;
@@ -169,9 +169,22 @@ function _set(newState) {
for (var key in newState) {
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
- if (!dirty) return;
+ if (!dirty && !this._changed) return false;
this._state = assign(assign({}, oldState), newState);
+
+ if (options && options.skipRender) {
+ if (!this._oldState) this._oldState = oldState;
+ this._changed = assign(changed, this._changed);
+ return true;
+ }
+
+ if (this._changed) {
+ oldState = this._oldState;
+ changed = assign(changed, this._changed),
+ this._changed = this._oldState = null;
+ }
+
this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state);
@@ -180,6 +193,7 @@ function _set(newState) {
this._fragment.p(changed, this._state);
this.fire("update", { changed: changed, current: this._state, previous: oldState });
}
+ return true;
}
function _mount(target, anchor) {
diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js
index 884f11d1d3..9d0f26df36 100644
--- a/test/cli/samples/dir-sourcemap/expected/Main.js
+++ b/test/cli/samples/dir-sourcemap/expected/Main.js
@@ -137,7 +137,7 @@ function set(newState) {
flush(this.root);
}
-function _set(newState) {
+function _set(newState, options) {
var oldState = this._state,
changed = {},
dirty = false;
@@ -145,9 +145,22 @@ function _set(newState) {
for (var key in newState) {
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
- if (!dirty) return;
+ if (!dirty && !this._changed) return false;
this._state = assign(assign({}, oldState), newState);
+
+ if (options && options.skipRender) {
+ if (!this._oldState) this._oldState = oldState;
+ this._changed = assign(changed, this._changed);
+ return true;
+ }
+
+ if (this._changed) {
+ oldState = this._oldState;
+ changed = assign(changed, this._changed),
+ this._changed = this._oldState = null;
+ }
+
this._recompute(changed, this._state);
if (this._bind) this._bind(changed, this._state);
@@ -156,6 +169,7 @@ function _set(newState) {
this._fragment.p(changed, this._state);
this.fire("update", { changed: changed, current: this._state, previous: oldState });
}
+ return true;
}
function _mount(target, anchor) {
diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js.map b/test/cli/samples/dir-sourcemap/expected/Main.js.map
index 1d09d8ade9..78e23900d6 100644
--- a/test/cli/samples/dir-sourcemap/expected/Main.js.map
+++ b/test/cli/samples/dir-sourcemap/expected/Main.js.map
@@ -1 +1 @@
-{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["
widget
"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["widget
"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index 4b1803f5fc..d55ad9252d 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -137,7 +137,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -145,9 +145,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -156,6 +169,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index 5c6241e320..85acf3362d 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -135,7 +135,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -143,9 +143,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -154,6 +167,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index dc82848d2e..db8e37a299 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -137,7 +137,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -145,9 +145,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -156,6 +169,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index 2896558acc..3272585b10 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -135,7 +135,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -143,9 +143,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -154,6 +167,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 62d5a02694..23d60a76da 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte vx.y.z */ +/* src/Main.html generated by Svelte v2.11.0 */ var Main = (function(answer) { "use strict"; answer = (answer && answer.__esModule) ? answer["default"] : answer; @@ -160,7 +160,7 @@ var Main = (function(answer) { "use strict"; flush(this.root); } - function _set(newState) { + function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -168,9 +168,22 @@ var Main = (function(answer) { "use strict"; for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -179,6 +192,7 @@ var Main = (function(answer) { "use strict"; this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index f4cbc7d8df..41bcb21adf 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -1,4 +1,4 @@ -/* src/Main.html generated by Svelte vx.y.z */ +/* src/Main.html generated by Svelte v2.12.0 */ function create_main_fragment(component, ctx) { var p; @@ -135,7 +135,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -143,9 +143,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -154,6 +167,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { @@ -180,4 +194,4 @@ function callAll(fns) { while (fns && fns.length) fns.shift()(); } export default Main; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ== diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 43ee0b6b7f..4aa6a89a33 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -135,7 +135,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -143,9 +143,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -154,6 +167,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/cli/samples/sourcemap/expected/Main.js.map b/test/cli/samples/sourcemap/expected/Main.js.map index a6fe370c69..ddf03feb32 100644 --- a/test/cli/samples/sourcemap/expected/Main.js.map +++ b/test/cli/samples/sourcemap/expected/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["Hello world!
\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["Hello world!
\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index e3beb9d80f..7dbef5e6bd 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -159,7 +159,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -167,9 +167,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -178,6 +191,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function _mount(target, anchor) { diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index 7d62bef134..bc43dc005e 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -100,7 +100,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -108,9 +108,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -119,6 +132,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index f0232218ac..03fe95e231 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -132,7 +132,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -140,9 +140,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -151,6 +164,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/collapses-text-around-comments/expected-bundle.js b/test/js/samples/collapses-text-around-comments/expected-bundle.js index 58f2fbb09c..54404a90e0 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -112,7 +112,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -120,9 +120,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -131,6 +144,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/component-static-array/expected-bundle.js b/test/js/samples/component-static-array/expected-bundle.js index 3bbb1ede27..e79f5517c0 100644 --- a/test/js/samples/component-static-array/expected-bundle.js +++ b/test/js/samples/component-static-array/expected-bundle.js @@ -88,7 +88,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -96,9 +96,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -107,6 +120,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index 98f6b26fec..de9b07fd4b 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -92,7 +92,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -100,9 +100,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -111,6 +124,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index 98f6b26fec..de9b07fd4b 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -92,7 +92,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -100,9 +100,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -111,6 +124,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 4c394bba1d..11d8560a12 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -88,7 +88,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -96,9 +96,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -107,6 +120,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 94cb7c3ef3..f26f7d4a5c 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -88,7 +88,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -96,9 +96,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -107,6 +120,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index 703ef5f6c0..38eb1515e2 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js index 0bb956d285..59a4d81b09 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -100,7 +100,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -108,9 +108,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -119,6 +132,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/debug-empty/expected-bundle.js b/test/js/samples/debug-empty/expected-bundle.js index 0faf822be3..3ec5c1033b 100644 --- a/test/js/samples/debug-empty/expected-bundle.js +++ b/test/js/samples/debug-empty/expected-bundle.js @@ -125,7 +125,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -133,9 +133,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -144,6 +157,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function setDev(newState) { diff --git a/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js b/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js index 521d57af5b..82e6fb7635 100644 --- a/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js +++ b/test/js/samples/debug-foo-bar-baz-things/expected-bundle.js @@ -131,7 +131,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -139,9 +139,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -150,6 +163,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function setDev(newState) { diff --git a/test/js/samples/debug-foo/expected-bundle.js b/test/js/samples/debug-foo/expected-bundle.js index 5cc1c7a469..a7e2c0611f 100644 --- a/test/js/samples/debug-foo/expected-bundle.js +++ b/test/js/samples/debug-foo/expected-bundle.js @@ -131,7 +131,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -139,9 +139,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -150,6 +163,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function setDev(newState) { diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index eae32e976c..8c4abeae16 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -122,7 +122,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -130,9 +130,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -141,6 +154,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 28b8d1f46b..b698bbe466 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -93,7 +93,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -101,9 +101,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -112,6 +125,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index 73fdae3223..7ca4a2846e 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -125,7 +125,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -133,9 +133,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -144,6 +157,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function setDev(newState) { diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index d981b929a7..b4f9e22f08 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js index 3be0e2a270..a507c84c56 100644 --- a/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js @@ -108,7 +108,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -116,9 +116,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -127,6 +140,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js index 5b73e51762..918f28b238 100644 --- a/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js +++ b/test/js/samples/dont-use-dataset-in-svg/expected-bundle.js @@ -108,7 +108,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -116,9 +116,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -127,6 +140,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index ce97c56af5..bd3eb27347 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -124,7 +124,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -132,9 +132,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -143,6 +156,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/each-block-keyed-animated/expected-bundle.js b/test/js/samples/each-block-keyed-animated/expected-bundle.js index 1cfdf681f0..2417c27cc7 100644 --- a/test/js/samples/each-block-keyed-animated/expected-bundle.js +++ b/test/js/samples/each-block-keyed-animated/expected-bundle.js @@ -427,7 +427,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -435,9 +435,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -446,6 +459,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/each-block-keyed/expected-bundle.js b/test/js/samples/each-block-keyed/expected-bundle.js index 1cc34f4455..5328875aec 100644 --- a/test/js/samples/each-block-keyed/expected-bundle.js +++ b/test/js/samples/each-block-keyed/expected-bundle.js @@ -207,7 +207,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -215,9 +215,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -226,6 +239,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 23327a276a..84710c2a5f 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -100,7 +100,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -108,9 +108,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -119,6 +132,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index 91eaa6cd5b..b5c252e0e8 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -100,7 +100,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -108,9 +108,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -119,6 +132,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/if-block-no-update/expected-bundle.js b/test/js/samples/if-block-no-update/expected-bundle.js index 83c3f60db0..3337ed46a4 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 24b9e526cd..df0d5c6090 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js index 78e6cc7e40..2a7972f168 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/inline-style-optimized-url/expected-bundle.js b/test/js/samples/inline-style-optimized-url/expected-bundle.js index 9fd8e681a6..b2167b0699 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index d8f9b7d7d2..58ecf9a44f 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index b46055315e..dcfcc87505 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -104,7 +104,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -112,9 +112,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -123,6 +136,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/input-files/expected-bundle.js b/test/js/samples/input-files/expected-bundle.js index b3218c7fd4..6eee764362 100644 --- a/test/js/samples/input-files/expected-bundle.js +++ b/test/js/samples/input-files/expected-bundle.js @@ -112,7 +112,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -120,9 +120,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -131,6 +144,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/input-range/expected-bundle.js b/test/js/samples/input-range/expected-bundle.js index 2f53e740ea..61db6b93b3 100644 --- a/test/js/samples/input-range/expected-bundle.js +++ b/test/js/samples/input-range/expected-bundle.js @@ -116,7 +116,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -124,9 +124,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -135,6 +148,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/input-without-blowback-guard/expected-bundle.js b/test/js/samples/input-without-blowback-guard/expected-bundle.js index b5f7a90f8c..8d644c98b2 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -112,7 +112,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -120,9 +120,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -131,6 +144,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index cd841f8a2d..a4e2df868a 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -106,7 +106,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -114,9 +114,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -125,6 +138,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index d9f961f564..419aa83410 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -116,7 +116,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -124,9 +124,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -135,6 +148,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index b890d8bed5..6923d44238 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -102,7 +102,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -110,9 +110,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -121,6 +134,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index fa63c78502..71b3bcb2da 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -88,7 +88,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -96,9 +96,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -107,6 +120,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 269f6ca1f3..0ac2e61941 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -108,7 +108,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -116,9 +116,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -127,6 +140,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index f0afba9d24..afcd2da045 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -88,7 +88,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -96,9 +96,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -107,6 +120,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/use-elements-as-anchors/expected-bundle.js b/test/js/samples/use-elements-as-anchors/expected-bundle.js index 4065ba55ad..b0c26ffdaa 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -112,7 +112,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -120,9 +120,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -131,6 +144,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 7823390a2c..315a13e5f9 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -112,7 +112,7 @@ function set(newState) { flush(this.root); } -function _set(newState) { +function _set(newState, options) { var oldState = this._state, changed = {}, dirty = false; @@ -120,9 +120,22 @@ function _set(newState) { for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty) return; + if (!dirty && !this._changed) return false; this._state = assign(assign({}, oldState), newState); + + if (options && options.skipRender) { + if (!this._oldState) this._oldState = oldState; + this._changed = assign(changed, this._changed); + return true; + } + + if (this._changed) { + oldState = this._oldState; + changed = assign(changed, this._changed), + this._changed = this._oldState = null; + } + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -131,6 +144,7 @@ function _set(newState) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } + return true; } function callAll(fns) { diff --git a/test/runtime/samples/store-child-data/Component.html b/test/runtime/samples/store-child-data/Component.html new file mode 100644 index 0000000000..df36fe5262 --- /dev/null +++ b/test/runtime/samples/store-child-data/Component.html @@ -0,0 +1 @@ +