From 2c24c361209664bdf622daf3cfa197ccb9ff113c Mon Sep 17 00:00:00 2001 From: Jacob Wright Date: Tue, 14 Aug 2018 23:17:06 -0600 Subject: [PATCH 1/4] Allows fragment updates to happen after state updates Proposed fix for #1520. Provides a starting point for discussion. --- src/shared/index.js | 18 +++++++++++++-- store.js | 13 +++++++---- test/cli/samples/amd/expected/Main.js | 18 +++++++++++++-- test/cli/samples/basic/expected/Main.js | 18 +++++++++++++-- .../samples/custom-element/expected/Main.js | 18 +++++++++++++-- test/cli/samples/dev/expected/Main.js | 18 +++++++++++++-- .../samples/dir-sourcemap/expected/Main.js | 18 +++++++++++++-- .../dir-sourcemap/expected/Main.js.map | 2 +- .../samples/dir-sourcemap/expected/Widget.js | 18 +++++++++++++-- .../dir-sourcemap/expected/Widget.js.map | 2 +- test/cli/samples/dir-subdir/expected/Main.js | 18 +++++++++++++-- .../dir-subdir/expected/widget/Widget.js | 18 +++++++++++++-- test/cli/samples/dir/expected/Main.js | 18 +++++++++++++-- test/cli/samples/dir/expected/Widget.js | 18 +++++++++++++-- test/cli/samples/globals/expected/Main.js | 20 ++++++++++++++--- .../samples/sourcemap-inline/expected/Main.js | 22 +++++++++++++++---- test/cli/samples/sourcemap/expected/Main.js | 18 +++++++++++++-- .../samples/sourcemap/expected/Main.js.map | 2 +- test/cli/samples/store/expected/Main.js | 18 +++++++++++++-- test/js/samples/action/expected-bundle.js | 18 +++++++++++++-- .../bind-width-height/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../component-static-array/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../component-static/expected-bundle.js | 18 +++++++++++++-- .../computed-collapsed-if/expected-bundle.js | 18 +++++++++++++-- .../css-media-query/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../js/samples/debug-empty/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- test/js/samples/debug-foo/expected-bundle.js | 18 +++++++++++++-- .../deconflict-builtins/expected-bundle.js | 18 +++++++++++++-- .../deconflict-globals/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../samples/do-use-dataset/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../each-block-keyed/expected-bundle.js | 18 +++++++++++++-- .../event-handlers-custom/expected-bundle.js | 18 +++++++++++++-- .../head-no-whitespace/expected-bundle.js | 18 +++++++++++++-- .../if-block-no-update/expected-bundle.js | 18 +++++++++++++-- .../if-block-simple/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../inline-style-optimized/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../js/samples/input-files/expected-bundle.js | 18 +++++++++++++-- .../js/samples/input-range/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../legacy-input-type/expected-bundle.js | 18 +++++++++++++-- .../samples/media-bindings/expected-bundle.js | 18 +++++++++++++-- .../non-imported-component/expected-bundle.js | 18 +++++++++++++-- .../samples/setup-method/expected-bundle.js | 18 +++++++++++++-- test/js/samples/svg-title/expected-bundle.js | 18 +++++++++++++-- test/js/samples/title/expected-bundle.js | 18 +++++++++++++-- .../expected-bundle.js | 18 +++++++++++++-- .../window-binding-scroll/expected-bundle.js | 18 +++++++++++++-- .../samples/store-child-data/Component.html | 1 + .../samples/store-child-data/_config.js | 22 +++++++++++++++++++ .../samples/store-child-data/main.html | 9 ++++++++ 63 files changed, 943 insertions(+), 122 deletions(-) create mode 100644 test/runtime/samples/store-child-data/Component.html create mode 100644 test/runtime/samples/store-child-data/_config.js create mode 100644 test/runtime/samples/store-child-data/main.html 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":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index 99c6e08a0e..d671a74fa4 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/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/dir-sourcemap/expected/Widget.js.map b/test/cli/samples/dir-sourcemap/expected/Widget.js.map index f4303844df..0751cc8243 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js.map @@ -1 +1 @@ -{"version":3,"file":"Widget.js","sources":["../src/Widget.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 @@ +

{$items[index].title}

\ No newline at end of file diff --git a/test/runtime/samples/store-child-data/_config.js b/test/runtime/samples/store-child-data/_config.js new file mode 100644 index 0000000000..4322386f45 --- /dev/null +++ b/test/runtime/samples/store-child-data/_config.js @@ -0,0 +1,22 @@ +import { Store } from '../../../../store.js'; + +const store = new Store({ + selectedIndex: 0, + items: [{ title: 'One' }, { title: 'Two' }] +}); + +export default { + store, + + html: ` +

One

+ `, + + test(assert, component, target, window) { + store.set({ selectedIndex: 2, items: [{ title: 'One' }, { title: 'Two' }, { title: 'Three' }]}); + + assert.htmlEqual(target.innerHTML, ` +

Three

+ `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/store-child-data/main.html b/test/runtime/samples/store-child-data/main.html new file mode 100644 index 0000000000..0f3f9862de --- /dev/null +++ b/test/runtime/samples/store-child-data/main.html @@ -0,0 +1,9 @@ + + + \ No newline at end of file From c2f0ca3e2e43e635d1ff2b33349b50ffb3c54c19 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 25 Aug 2018 06:58:31 -0400 Subject: [PATCH 2/4] alternative approach to #1520 --- src/compile/dom/index.ts | 2 +- src/shared/index.js | 27 ++++++------- store.js | 38 +++++++++---------- test/cli/samples/amd/expected/Main.js | 26 ++++++------- test/cli/samples/basic/expected/Main.js | 26 ++++++------- .../samples/custom-element/expected/Main.js | 26 ++++++------- test/cli/samples/dev/expected/Main.js | 26 ++++++------- .../samples/dir-sourcemap/expected/Main.js | 26 ++++++------- .../dir-sourcemap/expected/Main.js.map | 2 +- .../samples/dir-sourcemap/expected/Widget.js | 26 ++++++------- .../dir-sourcemap/expected/Widget.js.map | 2 +- test/cli/samples/dir-subdir/expected/Main.js | 26 ++++++------- .../dir-subdir/expected/widget/Widget.js | 26 ++++++------- test/cli/samples/dir/expected/Main.js | 26 ++++++------- test/cli/samples/dir/expected/Widget.js | 26 ++++++------- test/cli/samples/globals/expected/Main.js | 28 ++++++-------- .../samples/sourcemap-inline/expected/Main.js | 30 +++++++-------- test/cli/samples/sourcemap/expected/Main.js | 26 ++++++------- .../samples/sourcemap/expected/Main.js.map | 2 +- test/cli/samples/store/expected/Main.js | 26 ++++++------- test/js/samples/action/expected-bundle.js | 28 ++++++-------- test/js/samples/action/expected.js | 2 +- .../bind-width-height/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../component-static-array/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../component-static/expected-bundle.js | 26 ++++++------- .../computed-collapsed-if/expected-bundle.js | 26 ++++++------- .../css-media-query/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../js/samples/debug-empty/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- test/js/samples/debug-foo/expected-bundle.js | 26 ++++++------- .../deconflict-builtins/expected-bundle.js | 26 ++++++------- .../deconflict-globals/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../samples/do-use-dataset/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../each-block-keyed/expected-bundle.js | 26 ++++++------- .../event-handlers-custom/expected-bundle.js | 26 ++++++------- .../head-no-whitespace/expected-bundle.js | 26 ++++++------- .../if-block-no-update/expected-bundle.js | 26 ++++++------- .../if-block-simple/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../inline-style-optimized/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../js/samples/input-files/expected-bundle.js | 26 ++++++------- .../js/samples/input-range/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../legacy-input-type/expected-bundle.js | 26 ++++++------- .../samples/media-bindings/expected-bundle.js | 26 ++++++------- .../non-imported-component/expected-bundle.js | 26 ++++++------- .../select-dynamic-value/expected-bundle.js | 10 +++++ .../samples/setup-method/expected-bundle.js | 26 ++++++------- test/js/samples/svg-title/expected-bundle.js | 26 ++++++------- test/js/samples/title/expected-bundle.js | 26 ++++++------- .../expected-bundle.js | 26 ++++++------- .../window-binding-scroll/expected-bundle.js | 26 ++++++------- 63 files changed, 655 insertions(+), 868 deletions(-) diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index 79645f4081..3ced0254a2 100644 --- a/src/compile/dom/index.ts +++ b/src/compile/dom/index.ts @@ -132,7 +132,7 @@ export default function dom( ? `@proto` : deindent` { - ${['destroy', 'get', 'fire', 'on', 'set', '_set', '_mount', '_differs'] + ${['destroy', 'get', 'fire', 'on', 'set', '_set', '_stage', '_mount', '_differs'] .map(n => `${n}: @${n}`) .join(',\n')} }`; diff --git a/src/shared/index.js b/src/shared/index.js index f2621472fd..f178bdfba7 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -73,6 +73,7 @@ export function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -103,30 +104,21 @@ export function set(newState) { flush(this.root); } -export function _set(newState, options) { +export function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +127,10 @@ export function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +export function _stage(newState) { + assign(this._staged, newState); } export function setDev(newState) { @@ -173,6 +168,7 @@ export var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; @@ -185,6 +181,7 @@ export var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/store.js b/store.js index cc97eddb8a..ad7db26194 100644 --- a/store.js +++ b/store.js @@ -60,27 +60,27 @@ assign(Store.prototype, { current: this._state }); - const dependents = this._dependents.slice(); // guard against mutations - const options = { skipRender: true }; - const empty = {}; - const dirtyDependents = dependents.filter(dependent => { - const componentState = {}; - let dirty = false; - - for (let j = 0; j < dependent.props.length; j += 1) { - const prop = dependent.props[j]; - if (prop in changed) { - componentState['$' + prop] = this._state[prop]; - dirty = true; + this._dependents + .filter(dependent => { + const componentState = {}; + let dirty = false; + + for (let j = 0; j < dependent.props.length; j += 1) { + const prop = dependent.props[j]; + if (prop in changed) { + componentState['$' + prop] = this._state[prop]; + dirty = true; + } } - } - if (dirty) { - return dependent.component._set(componentState, options); - } - }); - - dirtyDependents.forEach(dependent => dependent.component.set(empty)); + if (dirty) { + dependent.component._stage(componentState); + return true; + } + }) + .forEach(dependent => { + dependent.component.set(); + }); this.fire('update', { changed, diff --git a/test/cli/samples/amd/expected/Main.js b/test/cli/samples/amd/expected/Main.js index bbdc8c40de..e1d5ff49de 100644 --- a/test/cli/samples/amd/expected/Main.js +++ b/test/cli/samples/amd/expected/Main.js @@ -43,6 +43,7 @@ define("test", function() { "use strict"; on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ define("test", function() { "use strict"; component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ define("test", function() { "use strict"; flush(this.root); } - function _set(newState, options) { + function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ define("test", function() { "use strict"; this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; + } + + function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index a2184f1082..33a814b893 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -43,6 +43,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } 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 dc26df5ccb..e3b62932bd 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -57,6 +57,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -88,6 +89,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -156,30 +158,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -188,7 +181,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index 02c90d3ec6..bc00172d44 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -50,6 +50,7 @@ assign(Main.prototype, { on: on, set: setDev, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -91,6 +92,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -161,30 +163,21 @@ function setDev(newState) { set.call(this, newState); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -193,7 +186,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } 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 9d0f26df36..17b9ea2969 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -49,6 +49,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -61,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -137,30 +139,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -169,7 +162,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } 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 78e23900d6..99bf481039 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":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index d671a74fa4..b4ae7743d5 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -43,6 +43,7 @@ assign(Widget.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js.map b/test/cli/samples/dir-sourcemap/expected/Widget.js.map index 0751cc8243..dbfc4c78f6 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js.map @@ -1 +1 @@ -{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index d55ad9252d..48f0596e3c 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -49,6 +49,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -61,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -137,30 +139,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -169,7 +162,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } 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 85acf3362d..08858aee63 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -43,6 +43,7 @@ assign(Widget.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index db8e37a299..24da010131 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -49,6 +49,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -61,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -137,30 +139,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -169,7 +162,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index 3272585b10..3e5a538fc1 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -43,6 +43,7 @@ assign(Widget.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index 23d60a76da..c578cbf2e3 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 v2.11.0 */ +/* src/Main.html generated by Svelte vx.y.z */ var Main = (function(answer) { "use strict"; answer = (answer && answer.__esModule) ? answer["default"] : answer; @@ -58,6 +58,7 @@ var Main = (function(answer) { "use strict"; on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -92,6 +93,7 @@ var Main = (function(answer) { "use strict"; component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -160,30 +162,21 @@ var Main = (function(answer) { "use strict"; flush(this.root); } - function _set(newState, options) { + function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -192,7 +185,10 @@ 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 _stage(newState) { + assign(this._staged, newState); } 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 41bcb21adf..7ecedd8afc 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 v2.12.0 */ +/* src/Main.html generated by Svelte vx.y.z */ function create_main_fragment(component, ctx) { var p; @@ -43,6 +43,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { @@ -194,4 +190,4 @@ function callAll(fns) { while (fns && fns.length) fns.shift()(); } export default Main; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9 diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 4aa6a89a33..8f8e38c84d 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -43,6 +43,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -67,6 +68,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -135,30 +137,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -167,7 +160,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } 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 ddf03feb32..c95bf0cb91 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["

Hello world!

\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index 7dbef5e6bd..699ecb434e 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -53,6 +53,7 @@ assign(Main.prototype, { on: on, set: set, _set: _set, + _stage: _stage, _mount: _mount, _differs: _differs }); @@ -87,6 +88,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -159,30 +161,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -191,7 +184,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function _mount(target, anchor) { diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index bc43dc005e..b05b0a36f4 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -100,30 +101,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -132,7 +124,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -151,6 +146,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; @@ -158,7 +154,7 @@ var proto = { /* generated by Svelte vX.Y.Z */ function link(node) { - + function onClick(event) { event.preventDefault(); history.pushState(null, null, event.target.href); diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js index fab6e6a2b6..2c173d0133 100644 --- a/test/js/samples/action/expected.js +++ b/test/js/samples/action/expected.js @@ -2,7 +2,7 @@ import { assign, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js"; function link(node) { - + function onClick(event) { event.preventDefault(); history.pushState(null, null, event.target.href); diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index 03fe95e231..0e39cd0082 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -102,6 +102,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -132,30 +133,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -164,7 +156,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -183,6 +178,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 54404a90e0..4237251ca5 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -112,30 +113,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +136,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -163,6 +158,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static-array/expected-bundle.js b/test/js/samples/component-static-array/expected-bundle.js index e79f5517c0..730f5fe08d 100644 --- a/test/js/samples/component-static-array/expected-bundle.js +++ b/test/js/samples/component-static-array/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -88,30 +89,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -120,7 +112,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -139,6 +134,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index de9b07fd4b..7a1eae18bd 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -62,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -92,30 +93,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -124,7 +116,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -143,6 +138,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index de9b07fd4b..7a1eae18bd 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -62,6 +62,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -92,30 +93,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -124,7 +116,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -143,6 +138,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 11d8560a12..8894cef94a 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -88,30 +89,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -120,7 +112,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -139,6 +134,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index f26f7d4a5c..54fbb17dfe 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -88,30 +89,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -120,7 +112,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -139,6 +134,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index 38eb1515e2..f5d45282c7 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 59a4d81b09..c31dc80868 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -100,30 +101,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -132,7 +124,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -151,6 +146,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/debug-empty/expected-bundle.js b/test/js/samples/debug-empty/expected-bundle.js index 3ec5c1033b..836da9ec13 100644 --- a/test/js/samples/debug-empty/expected-bundle.js +++ b/test/js/samples/debug-empty/expected-bundle.js @@ -95,6 +95,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -125,30 +126,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -157,7 +149,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function setDev(newState) { @@ -187,6 +182,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; 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 82e6fb7635..e065526f46 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 @@ -101,6 +101,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -131,30 +132,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -163,7 +155,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function setDev(newState) { @@ -193,6 +188,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/debug-foo/expected-bundle.js b/test/js/samples/debug-foo/expected-bundle.js index a7e2c0611f..9f63d821c1 100644 --- a/test/js/samples/debug-foo/expected-bundle.js +++ b/test/js/samples/debug-foo/expected-bundle.js @@ -101,6 +101,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -131,30 +132,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -163,7 +155,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function setDev(newState) { @@ -193,6 +188,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index 8c4abeae16..2ca3005a6d 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -92,6 +92,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -122,30 +123,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +146,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -173,6 +168,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index b698bbe466..264d4f2997 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -63,6 +63,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -93,30 +94,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +117,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -144,6 +139,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 7ca4a2846e..f389d5b61f 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 @@ -95,6 +95,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -125,30 +126,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -157,7 +149,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function setDev(newState) { @@ -187,6 +182,7 @@ var protoDev = { set: setDev, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index b4f9e22f08..3999854ba2 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 a507c84c56..bb07f5b2ec 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 @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -108,30 +109,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -140,7 +132,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -159,6 +154,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 918f28b238..72320b8787 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 @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -108,30 +109,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -140,7 +132,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -159,6 +154,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 bd3eb27347..cf589ed35f 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -94,6 +94,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -124,30 +125,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +148,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -175,6 +170,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 2417c27cc7..a77947e64f 100644 --- a/test/js/samples/each-block-keyed-animated/expected-bundle.js +++ b/test/js/samples/each-block-keyed-animated/expected-bundle.js @@ -397,6 +397,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -427,30 +428,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -459,7 +451,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -478,6 +473,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/each-block-keyed/expected-bundle.js b/test/js/samples/each-block-keyed/expected-bundle.js index 5328875aec..d316cc59e2 100644 --- a/test/js/samples/each-block-keyed/expected-bundle.js +++ b/test/js/samples/each-block-keyed/expected-bundle.js @@ -177,6 +177,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -207,30 +208,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -239,7 +231,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -258,6 +253,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 84710c2a5f..91e25f29b0 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -100,30 +101,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -132,7 +124,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -151,6 +146,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index b5c252e0e8..d753546f73 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -70,6 +70,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -100,30 +101,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -132,7 +124,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -151,6 +146,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 3337ed46a4..35359986d5 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index df0d5c6090..346da11fe1 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 2a7972f168..e63af6741b 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 b2167b0699..0df847bbef 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index 58ecf9a44f..eb45ed55f6 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index dcfcc87505..a8e204eb17 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -74,6 +74,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -104,30 +105,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -136,7 +128,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -155,6 +150,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/input-files/expected-bundle.js b/test/js/samples/input-files/expected-bundle.js index 6eee764362..7c3c064c14 100644 --- a/test/js/samples/input-files/expected-bundle.js +++ b/test/js/samples/input-files/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -112,30 +113,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +136,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -163,6 +158,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/input-range/expected-bundle.js b/test/js/samples/input-range/expected-bundle.js index 61db6b93b3..f9cde9c06d 100644 --- a/test/js/samples/input-range/expected-bundle.js +++ b/test/js/samples/input-range/expected-bundle.js @@ -86,6 +86,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -116,30 +117,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -148,7 +140,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -167,6 +162,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 8d644c98b2..55c7819baf 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -112,30 +113,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +136,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -163,6 +158,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index a4e2df868a..2b0ce9b3b8 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -76,6 +76,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -106,30 +107,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -138,7 +130,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -157,6 +152,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index 419aa83410..c61a74d5ae 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -86,6 +86,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -116,30 +117,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -148,7 +140,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -167,6 +162,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index 6923d44238..a230bdf762 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -72,6 +72,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -102,30 +103,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -134,7 +126,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -153,6 +148,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/select-dynamic-value/expected-bundle.js b/test/js/samples/select-dynamic-value/expected-bundle.js index 1230856164..56fa22a859 100644 --- a/test/js/samples/select-dynamic-value/expected-bundle.js +++ b/test/js/samples/select-dynamic-value/expected-bundle.js @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -113,12 +114,16 @@ function _set(newState) { changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } if (!dirty) return; this._state = assign(assign({}, oldState), newState); + this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -129,6 +134,10 @@ function _set(newState) { } } +function _stage(newState) { + assign(this._staged, newState); +} + function callAll(fns) { while (fns && fns.length) fns.shift()(); } @@ -145,6 +154,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index 71b3bcb2da..a059ea0abb 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -88,30 +89,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -120,7 +112,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -139,6 +134,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 0ac2e61941..293be218e3 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -78,6 +78,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -108,30 +109,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -140,7 +132,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -159,6 +154,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index afcd2da045..85e0254f0f 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -58,6 +58,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -88,30 +89,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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); @@ -120,7 +112,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -139,6 +134,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; 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 b0c26ffdaa..dff42ca138 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -112,30 +113,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +136,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -163,6 +158,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 315a13e5f9..774f5eedf0 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -82,6 +82,7 @@ function init(component, options) { component._handlers = blankObject(); component._slots = blankObject(); component._bind = options._bind; + component._staged = {}; component.options = options; component.root = options.root || component; @@ -112,30 +113,21 @@ function set(newState) { flush(this.root); } -function _set(newState, options) { +function _set(newState) { var oldState = this._state, changed = {}, dirty = false; + newState = assign(this._staged, newState); + this._staged = {}; + for (var key in newState) { if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true; } - if (!dirty && !this._changed) return false; + if (!dirty) return; 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,7 +136,10 @@ function _set(newState, options) { this._fragment.p(changed, this._state); this.fire("update", { changed: changed, current: this._state, previous: oldState }); } - return true; +} + +function _stage(newState) { + assign(this._staged, newState); } function callAll(fns) { @@ -163,6 +158,7 @@ var proto = { set, _recompute: noop, _set, + _stage, _mount, _differs }; From 645f9e3894a0952c034871c212fed6e17fb610a1 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 25 Aug 2018 07:06:46 -0400 Subject: [PATCH 3/4] oops, we need that argument --- store.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store.js b/store.js index ad7db26194..9405ccb0d0 100644 --- a/store.js +++ b/store.js @@ -79,7 +79,7 @@ assign(Store.prototype, { } }) .forEach(dependent => { - dependent.component.set(); + dependent.component.set({}); }); this.fire('update', { From a18cec0ec6139acc8abf90360564ee42713009cd Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 25 Aug 2018 07:08:08 -0400 Subject: [PATCH 4/4] not sure where that extra blank line came from --- src/shared/index.js | 1 - test/cli/samples/amd/expected/Main.js | 1 - test/cli/samples/basic/expected/Main.js | 1 - test/cli/samples/custom-element/expected/Main.js | 1 - test/cli/samples/dev/expected/Main.js | 1 - test/cli/samples/dir-sourcemap/expected/Main.js | 1 - test/cli/samples/dir-sourcemap/expected/Main.js.map | 2 +- test/cli/samples/dir-sourcemap/expected/Widget.js | 1 - test/cli/samples/dir-sourcemap/expected/Widget.js.map | 2 +- test/cli/samples/dir-subdir/expected/Main.js | 1 - test/cli/samples/dir-subdir/expected/widget/Widget.js | 1 - test/cli/samples/dir/expected/Main.js | 1 - test/cli/samples/dir/expected/Widget.js | 1 - test/cli/samples/globals/expected/Main.js | 1 - test/cli/samples/sourcemap-inline/expected/Main.js | 3 +-- test/cli/samples/sourcemap/expected/Main.js | 1 - test/cli/samples/sourcemap/expected/Main.js.map | 2 +- test/cli/samples/store/expected/Main.js | 1 - test/js/samples/action/expected-bundle.js | 1 - test/js/samples/bind-width-height/expected-bundle.js | 1 - .../samples/collapses-text-around-comments/expected-bundle.js | 1 - test/js/samples/component-static-array/expected-bundle.js | 1 - test/js/samples/component-static-immutable/expected-bundle.js | 1 - test/js/samples/component-static-immutable2/expected-bundle.js | 1 - test/js/samples/component-static/expected-bundle.js | 1 - test/js/samples/computed-collapsed-if/expected-bundle.js | 1 - test/js/samples/css-media-query/expected-bundle.js | 1 - test/js/samples/css-shadow-dom-keyframes/expected-bundle.js | 1 - test/js/samples/debug-empty/expected-bundle.js | 1 - test/js/samples/debug-foo-bar-baz-things/expected-bundle.js | 1 - test/js/samples/debug-foo/expected-bundle.js | 1 - test/js/samples/deconflict-builtins/expected-bundle.js | 1 - test/js/samples/deconflict-globals/expected-bundle.js | 1 - .../dev-warning-missing-data-computed/expected-bundle.js | 1 - test/js/samples/do-use-dataset/expected-bundle.js | 1 - test/js/samples/dont-use-dataset-in-legacy/expected-bundle.js | 1 - test/js/samples/dont-use-dataset-in-svg/expected-bundle.js | 1 - test/js/samples/each-block-changed-check/expected-bundle.js | 1 - test/js/samples/each-block-keyed-animated/expected-bundle.js | 1 - test/js/samples/each-block-keyed/expected-bundle.js | 1 - test/js/samples/event-handlers-custom/expected-bundle.js | 1 - test/js/samples/head-no-whitespace/expected-bundle.js | 1 - test/js/samples/if-block-no-update/expected-bundle.js | 1 - test/js/samples/if-block-simple/expected-bundle.js | 1 - .../samples/inline-style-optimized-multiple/expected-bundle.js | 1 - test/js/samples/inline-style-optimized-url/expected-bundle.js | 1 - test/js/samples/inline-style-optimized/expected-bundle.js | 1 - test/js/samples/inline-style-unoptimized/expected-bundle.js | 1 - test/js/samples/input-files/expected-bundle.js | 1 - test/js/samples/input-range/expected-bundle.js | 1 - .../js/samples/input-without-blowback-guard/expected-bundle.js | 1 - test/js/samples/legacy-input-type/expected-bundle.js | 1 - test/js/samples/media-bindings/expected-bundle.js | 1 - test/js/samples/non-imported-component/expected-bundle.js | 1 - test/js/samples/select-dynamic-value/expected-bundle.js | 1 - test/js/samples/setup-method/expected-bundle.js | 1 - test/js/samples/svg-title/expected-bundle.js | 1 - test/js/samples/title/expected-bundle.js | 1 - test/js/samples/use-elements-as-anchors/expected-bundle.js | 1 - test/js/samples/window-binding-scroll/expected-bundle.js | 1 - 60 files changed, 4 insertions(+), 61 deletions(-) diff --git a/src/shared/index.js b/src/shared/index.js index f178bdfba7..066942f1a6 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -118,7 +118,6 @@ export function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/amd/expected/Main.js b/test/cli/samples/amd/expected/Main.js index e1d5ff49de..5f236d668f 100644 --- a/test/cli/samples/amd/expected/Main.js +++ b/test/cli/samples/amd/expected/Main.js @@ -151,7 +151,6 @@ define("test", function() { "use strict"; if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/basic/expected/Main.js b/test/cli/samples/basic/expected/Main.js index 33a814b893..ba35a0c1e9 100644 --- a/test/cli/samples/basic/expected/Main.js +++ b/test/cli/samples/basic/expected/Main.js @@ -151,7 +151,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/custom-element/expected/Main.js b/test/cli/samples/custom-element/expected/Main.js index e3b62932bd..40865a2c81 100644 --- a/test/cli/samples/custom-element/expected/Main.js +++ b/test/cli/samples/custom-element/expected/Main.js @@ -172,7 +172,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dev/expected/Main.js b/test/cli/samples/dev/expected/Main.js index bc00172d44..bf46dffdd0 100644 --- a/test/cli/samples/dev/expected/Main.js +++ b/test/cli/samples/dev/expected/Main.js @@ -177,7 +177,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js b/test/cli/samples/dir-sourcemap/expected/Main.js index 17b9ea2969..0c0fab6094 100644 --- a/test/cli/samples/dir-sourcemap/expected/Main.js +++ b/test/cli/samples/dir-sourcemap/expected/Main.js @@ -153,7 +153,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dir-sourcemap/expected/Main.js.map b/test/cli/samples/dir-sourcemap/expected/Main.js.map index 99bf481039..621cf85109 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":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../src/Main.html"],"sourcesContent":["\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js b/test/cli/samples/dir-sourcemap/expected/Widget.js index b4ae7743d5..b6019a73fd 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js @@ -151,7 +151,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dir-sourcemap/expected/Widget.js.map b/test/cli/samples/dir-sourcemap/expected/Widget.js.map index dbfc4c78f6..57807d3fc0 100644 --- a/test/cli/samples/dir-sourcemap/expected/Widget.js.map +++ b/test/cli/samples/dir-sourcemap/expected/Widget.js.map @@ -1 +1 @@ -{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"Widget.js","sources":["../src/Widget.html"],"sourcesContent":["

widget

"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/dir-subdir/expected/Main.js b/test/cli/samples/dir-subdir/expected/Main.js index 48f0596e3c..2778c8c868 100644 --- a/test/cli/samples/dir-subdir/expected/Main.js +++ b/test/cli/samples/dir-subdir/expected/Main.js @@ -153,7 +153,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dir-subdir/expected/widget/Widget.js b/test/cli/samples/dir-subdir/expected/widget/Widget.js index 08858aee63..9282b7ddb4 100644 --- a/test/cli/samples/dir-subdir/expected/widget/Widget.js +++ b/test/cli/samples/dir-subdir/expected/widget/Widget.js @@ -151,7 +151,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dir/expected/Main.js b/test/cli/samples/dir/expected/Main.js index 24da010131..bbc005da76 100644 --- a/test/cli/samples/dir/expected/Main.js +++ b/test/cli/samples/dir/expected/Main.js @@ -153,7 +153,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/dir/expected/Widget.js b/test/cli/samples/dir/expected/Widget.js index 3e5a538fc1..c5981a4c53 100644 --- a/test/cli/samples/dir/expected/Widget.js +++ b/test/cli/samples/dir/expected/Widget.js @@ -151,7 +151,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/globals/expected/Main.js b/test/cli/samples/globals/expected/Main.js index c578cbf2e3..885d7da4bc 100644 --- a/test/cli/samples/globals/expected/Main.js +++ b/test/cli/samples/globals/expected/Main.js @@ -176,7 +176,6 @@ var Main = (function(answer) { "use strict"; if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/sourcemap-inline/expected/Main.js b/test/cli/samples/sourcemap-inline/expected/Main.js index 7ecedd8afc..668ff8b1bf 100644 --- a/test/cli/samples/sourcemap-inline/expected/Main.js +++ b/test/cli/samples/sourcemap-inline/expected/Main.js @@ -151,7 +151,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); @@ -190,4 +189,4 @@ function callAll(fns) { while (fns && fns.length) fns.shift()(); } export default Main; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWFpbi5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL01haW4uaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8cD5IZWxsbyB3b3JsZCE8L3A+XG5cbjxzY3JpcHQ+XG5cdGV4cG9ydCBkZWZhdWx0IHtcblx0XHRvbnJlbmRlciAoKSB7XG5cdFx0XHRjb25zb2xlLmxvZyggJ2hlcmUnICk7XG5cdFx0fVxuXHR9O1xuPC9zY3JpcHQ+Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0= diff --git a/test/cli/samples/sourcemap/expected/Main.js b/test/cli/samples/sourcemap/expected/Main.js index 8f8e38c84d..95e6718715 100644 --- a/test/cli/samples/sourcemap/expected/Main.js +++ b/test/cli/samples/sourcemap/expected/Main.js @@ -151,7 +151,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/cli/samples/sourcemap/expected/Main.js.map b/test/cli/samples/sourcemap/expected/Main.js.map index c95bf0cb91..a3be94cb9a 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/test/cli/samples/store/expected/Main.js b/test/cli/samples/store/expected/Main.js index 699ecb434e..03f4eb521d 100644 --- a/test/cli/samples/store/expected/Main.js +++ b/test/cli/samples/store/expected/Main.js @@ -175,7 +175,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index b05b0a36f4..62c04649ec 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -115,7 +115,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/bind-width-height/expected-bundle.js b/test/js/samples/bind-width-height/expected-bundle.js index 0e39cd0082..a4c740e120 100644 --- a/test/js/samples/bind-width-height/expected-bundle.js +++ b/test/js/samples/bind-width-height/expected-bundle.js @@ -147,7 +147,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 4237251ca5..3f0faa13fc 100644 --- a/test/js/samples/collapses-text-around-comments/expected-bundle.js +++ b/test/js/samples/collapses-text-around-comments/expected-bundle.js @@ -127,7 +127,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/component-static-array/expected-bundle.js b/test/js/samples/component-static-array/expected-bundle.js index 730f5fe08d..c2f94398c0 100644 --- a/test/js/samples/component-static-array/expected-bundle.js +++ b/test/js/samples/component-static-array/expected-bundle.js @@ -103,7 +103,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/component-static-immutable/expected-bundle.js b/test/js/samples/component-static-immutable/expected-bundle.js index 7a1eae18bd..ac9ae4d3f6 100644 --- a/test/js/samples/component-static-immutable/expected-bundle.js +++ b/test/js/samples/component-static-immutable/expected-bundle.js @@ -107,7 +107,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/component-static-immutable2/expected-bundle.js b/test/js/samples/component-static-immutable2/expected-bundle.js index 7a1eae18bd..ac9ae4d3f6 100644 --- a/test/js/samples/component-static-immutable2/expected-bundle.js +++ b/test/js/samples/component-static-immutable2/expected-bundle.js @@ -107,7 +107,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/component-static/expected-bundle.js b/test/js/samples/component-static/expected-bundle.js index 8894cef94a..c839759ecf 100644 --- a/test/js/samples/component-static/expected-bundle.js +++ b/test/js/samples/component-static/expected-bundle.js @@ -103,7 +103,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/computed-collapsed-if/expected-bundle.js b/test/js/samples/computed-collapsed-if/expected-bundle.js index 54fbb17dfe..c00e61971d 100644 --- a/test/js/samples/computed-collapsed-if/expected-bundle.js +++ b/test/js/samples/computed-collapsed-if/expected-bundle.js @@ -103,7 +103,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/css-media-query/expected-bundle.js b/test/js/samples/css-media-query/expected-bundle.js index f5d45282c7..80d50457d9 100644 --- a/test/js/samples/css-media-query/expected-bundle.js +++ b/test/js/samples/css-media-query/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 c31dc80868..fb563a9db5 100644 --- a/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js +++ b/test/js/samples/css-shadow-dom-keyframes/expected-bundle.js @@ -115,7 +115,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/debug-empty/expected-bundle.js b/test/js/samples/debug-empty/expected-bundle.js index 836da9ec13..a9f380840f 100644 --- a/test/js/samples/debug-empty/expected-bundle.js +++ b/test/js/samples/debug-empty/expected-bundle.js @@ -140,7 +140,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 e065526f46..8965e0ef1b 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 @@ -146,7 +146,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/debug-foo/expected-bundle.js b/test/js/samples/debug-foo/expected-bundle.js index 9f63d821c1..4b41d50d16 100644 --- a/test/js/samples/debug-foo/expected-bundle.js +++ b/test/js/samples/debug-foo/expected-bundle.js @@ -146,7 +146,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/deconflict-builtins/expected-bundle.js b/test/js/samples/deconflict-builtins/expected-bundle.js index 2ca3005a6d..a82fb4ecf7 100644 --- a/test/js/samples/deconflict-builtins/expected-bundle.js +++ b/test/js/samples/deconflict-builtins/expected-bundle.js @@ -137,7 +137,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/deconflict-globals/expected-bundle.js b/test/js/samples/deconflict-globals/expected-bundle.js index 264d4f2997..46d2f7bbf8 100644 --- a/test/js/samples/deconflict-globals/expected-bundle.js +++ b/test/js/samples/deconflict-globals/expected-bundle.js @@ -108,7 +108,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 f389d5b61f..2771b3228d 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 @@ -140,7 +140,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/do-use-dataset/expected-bundle.js b/test/js/samples/do-use-dataset/expected-bundle.js index 3999854ba2..ed3983ea68 100644 --- a/test/js/samples/do-use-dataset/expected-bundle.js +++ b/test/js/samples/do-use-dataset/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 bb07f5b2ec..5a011bbca1 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 @@ -123,7 +123,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 72320b8787..09f6cd4497 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 @@ -123,7 +123,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 cf589ed35f..faa49a664d 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -139,7 +139,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 a77947e64f..a7f5e22800 100644 --- a/test/js/samples/each-block-keyed-animated/expected-bundle.js +++ b/test/js/samples/each-block-keyed-animated/expected-bundle.js @@ -442,7 +442,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/each-block-keyed/expected-bundle.js b/test/js/samples/each-block-keyed/expected-bundle.js index d316cc59e2..3643c1c059 100644 --- a/test/js/samples/each-block-keyed/expected-bundle.js +++ b/test/js/samples/each-block-keyed/expected-bundle.js @@ -222,7 +222,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/event-handlers-custom/expected-bundle.js b/test/js/samples/event-handlers-custom/expected-bundle.js index 91e25f29b0..ea4b323271 100644 --- a/test/js/samples/event-handlers-custom/expected-bundle.js +++ b/test/js/samples/event-handlers-custom/expected-bundle.js @@ -115,7 +115,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/head-no-whitespace/expected-bundle.js b/test/js/samples/head-no-whitespace/expected-bundle.js index d753546f73..1a1b975edc 100644 --- a/test/js/samples/head-no-whitespace/expected-bundle.js +++ b/test/js/samples/head-no-whitespace/expected-bundle.js @@ -115,7 +115,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 35359986d5..6687f56cc3 100644 --- a/test/js/samples/if-block-no-update/expected-bundle.js +++ b/test/js/samples/if-block-no-update/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/if-block-simple/expected-bundle.js b/test/js/samples/if-block-simple/expected-bundle.js index 346da11fe1..2ed0f73584 100644 --- a/test/js/samples/if-block-simple/expected-bundle.js +++ b/test/js/samples/if-block-simple/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 e63af6741b..e6ea18a957 100644 --- a/test/js/samples/inline-style-optimized-multiple/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-multiple/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 0df847bbef..472c72db8a 100644 --- a/test/js/samples/inline-style-optimized-url/expected-bundle.js +++ b/test/js/samples/inline-style-optimized-url/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/inline-style-optimized/expected-bundle.js b/test/js/samples/inline-style-optimized/expected-bundle.js index eb45ed55f6..40425bcc01 100644 --- a/test/js/samples/inline-style-optimized/expected-bundle.js +++ b/test/js/samples/inline-style-optimized/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/inline-style-unoptimized/expected-bundle.js b/test/js/samples/inline-style-unoptimized/expected-bundle.js index a8e204eb17..ff6bfc0705 100644 --- a/test/js/samples/inline-style-unoptimized/expected-bundle.js +++ b/test/js/samples/inline-style-unoptimized/expected-bundle.js @@ -119,7 +119,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/input-files/expected-bundle.js b/test/js/samples/input-files/expected-bundle.js index 7c3c064c14..988d49a27e 100644 --- a/test/js/samples/input-files/expected-bundle.js +++ b/test/js/samples/input-files/expected-bundle.js @@ -127,7 +127,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/input-range/expected-bundle.js b/test/js/samples/input-range/expected-bundle.js index f9cde9c06d..45d1d42d33 100644 --- a/test/js/samples/input-range/expected-bundle.js +++ b/test/js/samples/input-range/expected-bundle.js @@ -131,7 +131,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 55c7819baf..0ba44bcddd 100644 --- a/test/js/samples/input-without-blowback-guard/expected-bundle.js +++ b/test/js/samples/input-without-blowback-guard/expected-bundle.js @@ -127,7 +127,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/legacy-input-type/expected-bundle.js b/test/js/samples/legacy-input-type/expected-bundle.js index 2b0ce9b3b8..a10dfa137d 100644 --- a/test/js/samples/legacy-input-type/expected-bundle.js +++ b/test/js/samples/legacy-input-type/expected-bundle.js @@ -121,7 +121,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/media-bindings/expected-bundle.js b/test/js/samples/media-bindings/expected-bundle.js index c61a74d5ae..e388684cab 100644 --- a/test/js/samples/media-bindings/expected-bundle.js +++ b/test/js/samples/media-bindings/expected-bundle.js @@ -131,7 +131,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/non-imported-component/expected-bundle.js b/test/js/samples/non-imported-component/expected-bundle.js index a230bdf762..ec8f608726 100644 --- a/test/js/samples/non-imported-component/expected-bundle.js +++ b/test/js/samples/non-imported-component/expected-bundle.js @@ -117,7 +117,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/select-dynamic-value/expected-bundle.js b/test/js/samples/select-dynamic-value/expected-bundle.js index 56fa22a859..08aae80e9e 100644 --- a/test/js/samples/select-dynamic-value/expected-bundle.js +++ b/test/js/samples/select-dynamic-value/expected-bundle.js @@ -123,7 +123,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/setup-method/expected-bundle.js b/test/js/samples/setup-method/expected-bundle.js index a059ea0abb..f36e9584c0 100644 --- a/test/js/samples/setup-method/expected-bundle.js +++ b/test/js/samples/setup-method/expected-bundle.js @@ -103,7 +103,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/svg-title/expected-bundle.js b/test/js/samples/svg-title/expected-bundle.js index 293be218e3..730857faec 100644 --- a/test/js/samples/svg-title/expected-bundle.js +++ b/test/js/samples/svg-title/expected-bundle.js @@ -123,7 +123,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/title/expected-bundle.js b/test/js/samples/title/expected-bundle.js index 85e0254f0f..096430361e 100644 --- a/test/js/samples/title/expected-bundle.js +++ b/test/js/samples/title/expected-bundle.js @@ -103,7 +103,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); 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 dff42ca138..c86845e7f2 100644 --- a/test/js/samples/use-elements-as-anchors/expected-bundle.js +++ b/test/js/samples/use-elements-as-anchors/expected-bundle.js @@ -127,7 +127,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state); diff --git a/test/js/samples/window-binding-scroll/expected-bundle.js b/test/js/samples/window-binding-scroll/expected-bundle.js index 774f5eedf0..57ab3aaf7b 100644 --- a/test/js/samples/window-binding-scroll/expected-bundle.js +++ b/test/js/samples/window-binding-scroll/expected-bundle.js @@ -127,7 +127,6 @@ function _set(newState) { if (!dirty) return; this._state = assign(assign({}, oldState), newState); - this._recompute(changed, this._state); if (this._bind) this._bind(changed, this._state);