Skip to content

Commit

Permalink
Make didCreate and didUpdate post-order
Browse files Browse the repository at this point in the history
  • Loading branch information
chancancode committed Sep 7, 2016
1 parent 172383e commit fb5c83e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/glimmer-runtime/lib/compiled/opcodes/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class OpenComponentOpcode extends Opcode {
vm.stack().pushSimpleBlock();
vm.pushRootScope(selfRef, layout.symbols);
vm.invokeLayout(args, layout, templates, callerScope, component, manager, shadow);
vm.env.didCreate(component, manager);

vm.updateWith(new UpdateComponentOpcode(definition.name, component, manager, args, dynamicScope));
}
Expand Down Expand Up @@ -100,7 +99,6 @@ export class UpdateComponentOpcode extends UpdatingOpcode {
let { component, manager, args, dynamicScope } = this;

manager.update(component, args, dynamicScope);
vm.env.didUpdate(component, manager);
}

toJSON(): OpcodeJSON {
Expand Down Expand Up @@ -167,6 +165,8 @@ export class DidRenderLayoutOpcode extends Opcode {

manager.didRenderLayout(component, bounds);

vm.env.didCreate(component, manager);

vm.updateWith(new DidUpdateLayoutOpcode(manager, component, bounds));
}
}
Expand All @@ -183,9 +183,12 @@ export class DidUpdateLayoutOpcode extends UpdatingOpcode {
super();
}

evaluate() {
evaluate(vm: UpdatingVM) {
let { manager, component, bounds } = this;

manager.didUpdateLayout(component, bounds);

vm.env.didUpdate(component, manager);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/glimmer-runtime/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export abstract class Environment {
manager.didCreate(component);
}

for (let i=this.updatedComponents.length-1; i>=0; i--) {
for (let i=0; i<this.updatedComponents.length; i++) {
let component = this.updatedComponents[i];
let manager = this.updatedManagers[i];
manager.didUpdate(component);
Expand Down

0 comments on commit fb5c83e

Please sign in to comment.