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`
var self = this;
var _oncreate = function() {
var initial = { changed: { ${expectedProperties.map(p => `${p}: 1`).join(', ')} }, current: self._state, previous: undefined };
${templateProperties.onstate && `%onstate.call(self, initial);`}
var changed = { ${expectedProperties.map(p => `${p}: 1`).join(', ')} };
${templateProperties.onstate && `%onstate.call(self, { changed: changed, current: self._state });`}
${templateProperties.oncreate && `%oncreate.call(self);`}
${templateProperties.onupdate && `%onupdate.call(self, initial);`}
self.fire("update", initial);
self.fire("update", { changed: changed, current: self._state });
};
`}

Loading…
Cancel
Save