prevent double-firing of update on init

pull/1344/head
Rich Harris 7 years ago
parent 43ea6bdf28
commit 6f4de8f237

@ -224,11 +224,10 @@ export default function dom(
${hasInitHooks && deindent` ${hasInitHooks && deindent`
var self = this; var self = this;
var _oncreate = function() { var _oncreate = function() {
var initial = { changed: { ${expectedProperties.map(p => `${p}: 1`).join(', ')} }, current: self._state, previous: undefined }; var changed = { ${expectedProperties.map(p => `${p}: 1`).join(', ')} };
${templateProperties.onstate && `%onstate.call(self, initial);`} ${templateProperties.onstate && `%onstate.call(self, { changed: changed, current: self._state });`}
${templateProperties.oncreate && `%oncreate.call(self);`} ${templateProperties.oncreate && `%oncreate.call(self);`}
${templateProperties.onupdate && `%onupdate.call(self, initial);`} self.fire("update", { changed: changed, current: self._state });
self.fire("update", initial);
}; };
`} `}

Loading…
Cancel
Save