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: relax list item constraint (#4554)

Bogdan Chadkin18082cb69f80
diff --git a/apps/builder/app/shared/matcher.test.tsx b/apps/builder/app/shared/matcher.test.tsx
index 950a1a1d83..5a4465bd67 100644
--- a/apps/builder/app/shared/matcher.test.tsx
+++ b/apps/builder/app/shared/matcher.test.tsx
@@ -13,6 +13,13 @@ import {
} from "./matcher";
const metas = new Map(Object.entries({ ...coreMetas, ...baseMetas }));
+metas.set("ListItem", {
+ ...baseMetas.ListItem,
+ constraints: {
+ relation: "parent",
+ component: { $eq: "List" },
+ },
+});
describe("is instance matching", () => {
test("matches self with self matcher", () => {
diff --git a/packages/sdk-components-react/src/list-item.ws.ts b/packages/sdk-components-react/src/list-item.ws.ts
index 683c32a3b2..69d2ad5241 100644
--- a/packages/sdk-components-react/src/list-item.ws.ts
+++ b/packages/sdk-components-react/src/list-item.ws.ts
@@ -17,7 +17,10 @@ export const meta: WsComponentMeta = {
category: "general",
type: "container",
constraints: {
- relation: "parent",
+ // cannot use parent relation here
+ // because list item can be put inside of collection or slot
+ // perhaps can be eventually fixed with tag matchers
+ relation: "ancestor",
component: { $eq: "List" },
},
description: "Adds a new item to an existing list.",