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 test and linter

Oleg Isonenfc26195ef264
diff --git a/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts b/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts
index 15eb0496ec..72ab7c4588 100644
--- a/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts
+++ b/apps/designer/app/designer/features/props-panel/use-props-logic.test.ts
@@ -50,7 +50,10 @@ describe("usePropsLogic", () => {
publish: jest.fn(),
})
);
- expect(res1.current.userProps[0]).toBeUndefined();
+ expect(res1.current.userProps[0]).toMatchObject({
+ prop: "tag",
+ value: "h1",
+ });
expect(res2.current.userProps[0]).toMatchObject({
prop: "type",
value: "submit",
diff --git a/packages/react-sdk/src/components/heading.tsx b/packages/react-sdk/src/components/heading.tsx
index a37abcdabd..5df7f5b8fb 100644
--- a/packages/react-sdk/src/components/heading.tsx
+++ b/packages/react-sdk/src/components/heading.tsx
@@ -1,15 +1,19 @@
-import React, { forwardRef, type ElementRef, type ComponentProps } from "react";
+import React, {
+ forwardRef,
+ createElement,
+ type ElementRef,
+ type ComponentProps,
+} from "react";
const defaultTag = "h1";
type Props = ComponentProps<typeof defaultTag> & {
- tag: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
+ tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
};
export const Heading = forwardRef<ElementRef<typeof defaultTag>, Props>(
- (props, ref) => {
- const H = props.tag;
- return <H {...props} ref={ref} />;
+ ({ tag, ...props }, ref) => {
+ return createElement(tag as string, { ...props, ref });
}
);