1
0
Fork 0

🐛 Fixed issue with how parts are injected

This commit is contained in:
Joost De Cock 2018-12-17 07:41:20 +01:00
parent 360df01792
commit 261e39ba41

View file

@ -111,9 +111,9 @@ Pattern.prototype.draft = function() {
this.is = "draft";
this.runHooks("preDraft");
for (let partName of this.config.draftOrder) {
let newPart = this.createPart();
this.parts[partName] = this.createPart();
if (typeof this.config.inject[partName] === "string") {
newPart.inject(this.parts[this.config.inject[partName]]);
this.parts[partName].inject(this.parts[this.config.inject[partName]]);
}
if (this.needs(partName)) {
let method = "draft" + capitalize(partName);
@ -121,7 +121,7 @@ Pattern.prototype.draft = function() {
throw new Error(
'Method "' + method + '" on pattern object is not callable'
);
this.parts[partName] = this[method](newPart);
this.parts[partName] = this[method](this.parts[partName]);
this.parts[partName].render = this.wants(partName);
}
}