diff --git a/src/compile/dom/index.ts b/src/compile/dom/index.ts index 0a02b664be..6baa397241 100644 --- a/src/compile/dom/index.ts +++ b/src/compile/dom/index.ts @@ -222,11 +222,12 @@ export default function dom( ${compiler.slots.size && `this.slots = {};`} + ${templateProperties.onstate && `%onstate.call(this, { changed: @assignTrue({}, this._state), current: this._state });`} + this._fragment = @create_main_fragment(this, this._state); ${hasInitHooks && deindent` this.root._oncreate.push(() => { - ${templateProperties.onstate && `%onstate.call(this, { changed: @assignTrue({}, this._state), current: this._state });`} ${templateProperties.oncreate && `%oncreate.call(this);`} this.fire("update", { changed: @assignTrue({}, this._state), current: this._state }); }); diff --git a/test/runtime/samples/onstate-before-render/_config.js b/test/runtime/samples/onstate-before-render/_config.js index 56e30077bd..97c3af5083 100644 --- a/test/runtime/samples/onstate-before-render/_config.js +++ b/test/runtime/samples/onstate-before-render/_config.js @@ -10,5 +10,7 @@ export default { 'oncreate', 'onupdate' ]); + + order.length = 0; } };