Skip to content

Commit

Permalink
fix(editor): render nothing for recursive instances (fix #130)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchas116 committed Jun 30, 2022
1 parent 24c9285 commit 531223d
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions packages/editor/src/mount/ElementMount.ts
Expand Up @@ -229,20 +229,25 @@ export class ElementMount {
this.attachedMount?.dispose();
this.attachedMount = undefined;

if (component) {
this.attachedMount = new RootElementMount(
component,
component?.defaultVariant,
{
...this.context,
boundingBoxUpdateScheduler: undefined,
registry: undefined,
topLevelVariant:
this.context.topLevelVariant ?? this.instance.variant,
},
this.dom as HTMLElement
);
if (!component) {
return;
}
if (component === this.instance.element.component) {
console.warn("Cannot render component recursively");
return;
}

this.attachedMount = new RootElementMount(
component,
component?.defaultVariant,
{
...this.context,
boundingBoxUpdateScheduler: undefined,
registry: undefined,
topLevelVariant: this.context.topLevelVariant ?? this.instance.variant,
},
this.dom as HTMLElement
);
}

private isDisposed = false;
Expand Down

1 comment on commit 531223d

@vercel
Copy link

@vercel vercel bot commented on 531223d Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.