Skip to content

Commit

Permalink
fix(render-slot): ensure that after insert, the render operation swit…
Browse files Browse the repository at this point in the history
…ches back to add
  • Loading branch information
EisenbergEffect committed Jul 13, 2018
1 parent fbcb9c9 commit 4cda527
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/templating/render-slot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function project_addVisual(visual: IVisual) {

function insertVisual(visual: IVisual) {
visual.$view.insertBefore(visual.parent.children[visual.renderState].$view.firstChild);
visual.onRender = (visual.parent as RenderSlotImplementation).addVisualCore;
}

function project_insertVisual(visual: IVisual) {
Expand All @@ -37,6 +38,7 @@ function project_insertVisual(visual: IVisual) {

ShadowDOMEmulation.distributeView(visual.$view, parent.slots, parent, index);
parent.logicalView.insertVisualChildBefore(visual, parent.children[index].$view.firstChild);
visual.onRender = (visual.parent as RenderSlotImplementation).addVisualCore;

visual.$view.remove = () => {
ShadowDOMEmulation.undistributeView(visual.$view, parent.slots, parent);
Expand Down Expand Up @@ -131,7 +133,7 @@ export const RenderSlot = {

class RenderSlotImplementation implements IRenderSlot {
private $isAttached = false;
private addVisualCore: (visual: IVisual) => void;
public addVisualCore: (visual: IVisual) => void;
private insertVisualCore: (visual: IVisual) => void;
private encapsulationSource: INode = null;

Expand Down Expand Up @@ -174,7 +176,6 @@ class RenderSlotImplementation implements IRenderSlot {

if (this.$isAttached) {
visual.$attach(this.encapsulationSource);
visual.onRender = this.addVisualCore;
return visual.animate(MotionDirection.enter);
}
}
Expand Down

0 comments on commit 4cda527

Please sign in to comment.