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.

use updated props in preview

Oleg Isonenb7763ecf5076
diff --git a/app/canvas/canvas.tsx b/app/canvas/canvas.tsx
index 3ef023989d..b054b10812 100644
--- a/app/canvas/canvas.tsx
+++ b/app/canvas/canvas.tsx
@@ -67,7 +67,7 @@ const useIsPreviewMode = () => {
export const Canvas = ({ data }: { data: Data }): JSX.Element => {
globalStyles();
- useAllUserProps(data.props);
+ const [allUserProps] = useAllUserProps(data.props);
const [rootInstance, setRootInstance] = usePopulateRootInstance(data.tree);
const { instanceInsertionSpec, instanceReparentingSpec } =
useDragDropHandlers({ rootInstance });
@@ -99,7 +99,7 @@ export const Canvas = ({ data }: { data: Data }): JSX.Element => {
<CanvasRoot
data={{
tree: { id: data.tree.id, root: rootInstance },
- props: data.props,
+ props: [...allUserProps.values()],
}}
/>
);
diff --git a/app/designer/settings-panel/use-props-logic.ts b/app/designer/settings-panel/use-props-logic.ts
index d11926140f..ce4c6fd410 100644
--- a/app/designer/settings-panel/use-props-logic.ts
+++ b/app/designer/settings-panel/use-props-logic.ts
@@ -1,10 +1,10 @@
import produce from "immer";
import { useState, useCallback, useEffect, useRef } from "react";
import debounce from "lodash.debounce";
-import type { Publish } from "~/designer/iframe";
+import ObjectId from "bson-objectid";
import type { DeleteProp, UserProp, UserPropsUpdates } from "@webstudio-is/sdk";
+import type { Publish } from "~/designer/iframe";
import type { SelectedInstanceData } from "~/shared/component";
-import ObjectId from "bson-objectid";
const getInitialProp = () => ({
id: ObjectId().toString(),