Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: insert properly from marketplace (#4725)

Bogdan Chadkin387530b84d70
diff --git a/apps/builder/app/builder/features/marketplace/templates.tsx b/apps/builder/app/builder/features/marketplace/templates.tsx
index 6835c6698e..64a4c7ff72 100644
--- a/apps/builder/app/builder/features/marketplace/templates.tsx
+++ b/apps/builder/app/builder/features/marketplace/templates.tsx
@@ -45,9 +45,16 @@ const insertSection = ({
instanceId: string;
}) => {
const fragment = extractWebstudioFragment(data, instanceId);
- fragment.instances = fragment.instances.filter(
- (instance) => instance.component !== "Body"
+ const body = fragment.instances.find(
+ (instance) => instance.component === "Body"
);
+ // remove body and use its children as root insrances
+ if (body) {
+ fragment.instances = fragment.instances.filter(
+ (instance) => instance.component !== "Body"
+ );
+ fragment.children = body.children;
+ }
const insertable = findClosestInsertable(fragment);
if (insertable) {
insertWebstudioFragmentAt(fragment, insertable);