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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Support effectful expressions in component actions (#1914)
Bogdan Chadkin05df3910f5eb
diff --git a/apps/builder/app/builder/features/props-panel/controls/combined.tsx b/apps/builder/app/builder/features/props-panel/controls/combined.tsxindex c150128ff9..d055f94618 100644--- a/apps/builder/app/builder/features/props-panel/controls/combined.tsx+++ b/apps/builder/app/builder/features/props-panel/controls/combined.tsx@@ -19,6 +19,11 @@ export const renderControl = ({throw Error("Data source is not resolved");}+ // @todo remove once ui for action is implemented+ if (prop?.type === "action") {+ return;+ }+if (meta.control === "text" &&(prop === undefined || prop.type === "string")diff --git a/apps/builder/app/builder/features/props-panel/use-props-logic.ts b/apps/builder/app/builder/features/props-panel/use-props-logic.tsindex a95639e5c8..ca0bed3b26 100644--- a/apps/builder/app/builder/features/props-panel/use-props-logic.ts+++ b/apps/builder/app/builder/features/props-panel/use-props-logic.ts@@ -50,6 +50,13 @@ export const getStartingValue = (meta: PropMeta): PropValue | undefined => {value: meta.defaultValue ?? [],};}++ if (meta.type === "action") {+ return {+ type: "action",+ value: [],+ };+ }};const getStartingProp = (@@ -63,6 +70,8 @@ const getStartingProp = (const getDefaultMetaForType = (type: Prop["type"]): PropMeta => {switch (type) {+ case "action":+ return { type: "action", control: "action", required: false };case "string":return { type: "string", control: "text", required: false };case "number":@@ -155,7 +164,7 @@ export const usePropsLogic = ({const systemProps = systemPropsMeta.map(({ name, meta }) => {let saved = getAndDelete(unprocessedSaved, name);- if (saved === undefined && meta.defaultValue !== undefined) {+ if (saved === undefined) {saved = getStartingProp(instanceId, meta, name);}getAndDelete(unprocessedKnown, name);@@ -184,7 +193,7 @@ export const usePropsLogic = ({// - where 0 is a fallback when no default is available// - they think that width is set to 0, but it's actually not set at all//- if (prop === undefined && known.defaultValue !== undefined) {+ if (prop === undefined) {prop = getStartingProp(instanceId, known, name);}diff --git a/apps/builder/app/canvas/canvas.tsx b/apps/builder/app/canvas/canvas.tsxindex 76607883ff..095f597a15 100644--- a/apps/builder/app/canvas/canvas.tsx+++ b/apps/builder/app/canvas/canvas.tsx@@ -1,11 +1,14 @@import { useMemo, useEffect } from "react";import { useStore } from "@nanostores/react";import { computed } from "nanostores";-import type { Instances, Page } from "@webstudio-is/project-build";+import type { DataSource, Instances, Page } from "@webstudio-is/project-build";import {type Params,type Components,createElementsTree,+ executeEffectfulExpression,+ encodeVariablesMap,+ decodeVariablesMap,} from "@webstudio-is/react-sdk";import * as baseComponents from "@webstudio-is/sdk-components-react";import * as baseComponentMetas from "@webstudio-is/sdk-components-react/metas";@@ -64,6 +67,21 @@ const temporaryInstances: Instances = new Map([],]);+const executeEffectfulExpressionWithDecodedVariables: typeof executeEffectfulExpression =+ (code, values) => {+ return decodeVariablesMap(+ executeEffectfulExpression(code, encodeVariablesMap(values))+ );+ };++const onDataSourceUpdate = (newValues: Map<DataSource["id"], unknown>) => {+ const dataSourceVariables = new Map(dataSourceVariablesStore.get());+ for (const [dataSourceId, value] of newValues) {+ dataSourceVariables.set(dataSourceId, value);+ }+ dataSourceVariablesStore.set(dataSourceVariables);+};+const useElementsTree = (components: Components, params: Params) => {const instances = useStore(instancesStore);const page = useStore(selectedPageStore);@@ -106,11 +124,9 @@ const useElementsTree = (components: Components, params: Params) => {assetsStore,pagesStore: pagesMapStore,dataSourceValuesStore,- onDataSourceUpdate: (dataSourceId, value) => {- const dataSourceVariables = new Map(dataSourceVariablesStore.get());- dataSourceVariables.set(dataSourceId, value);- dataSourceVariablesStore.set(dataSourceVariables);- },+ executeEffectfulExpression:+ executeEffectfulExpressionWithDecodedVariables,+ onDataSourceUpdate,Component: WebstudioComponentDev,components,});diff --git a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsxindex ec7c847496..939252b892 100644--- a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx+++ b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx@@ -183,12 +183,21 @@ export const WebstudioComponentDev = ({onClick: (event: MouseEvent) => {event.preventDefault();if (event.currentTarget instanceof HTMLAnchorElement) {+ // @todo use Navigation API once implemented everywhere+ // https://developer.mozilla.org/en-US/docs/Web/API/Navigation_APIhandleLinkClick(event);+ } else if (typeof userProps.onClick === "function") {+ // bypass onClick for non-link component, for example button+ userProps.onClick(event);}},onSubmit: (event: FormEvent) => {// Prevent submitting the form when clicking a button type submitevent.preventDefault();+ if (typeof userProps.onSubmit === "function") {+ // bypass handler+ userProps.onSubmit(event);+ }},};diff --git a/apps/builder/app/shared/copy-paste/plugin-instance.ts b/apps/builder/app/shared/copy-paste/plugin-instance.tsindex 007a66b045..b5ba96c481 100644--- a/apps/builder/app/shared/copy-paste/plugin-instance.ts+++ b/apps/builder/app/shared/copy-paste/plugin-instance.ts@@ -134,7 +134,8 @@ const getAssetsUsedInProps = (props: Prop[], foundAssetsIds = new Set()) => {prop.type === "boolean" ||prop.type === "page" ||prop.type === "string[]" ||- prop.type === "dataSource"+ prop.type === "dataSource" ||+ prop.type === "action") {continue;}diff --git a/package.json b/package.jsonindex dec1d10e26..386ba57281 100644--- a/package.json+++ b/package.json@@ -10,6 +10,7 @@"size-test": "turbo run size-test","checks": "turbo run checks","dev": "pnpm run --parallel --recursive dev",+ "lint": "pnpm eslint . --ext .ts,.tsx --max-warnings 0","format": "prettier --write \"**/*.{ts,tsx,md}\"","storybook": "pnpm run --parallel --recursive storybook:dev","storybook:build": "storybook build",diff --git a/packages/generate-arg-types/src/types.ts b/packages/generate-arg-types/src/types.tsindex eb37d2cc86..de8f681e91 100644--- a/packages/generate-arg-types/src/types.ts+++ b/packages/generate-arg-types/src/types.ts@@ -155,6 +155,12 @@ const Date = z.object({defaultValue: z.string().optional(),});+const Action = z.object({+ ...common,+ control: z.literal("action"),+ type: z.literal("action"),+});+export const PropMeta = z.union([Number,Range,@@ -172,6 +178,7 @@ export const PropMeta = z.union([Url,ObjectType,Date,+ Action,]);export type PropMeta = z.infer<typeof PropMeta>;diff --git a/packages/project-build/src/schema/props.ts b/packages/project-build/src/schema/props.tsindex 6a559ac5d0..dcc52a0a3e 100644--- a/packages/project-build/src/schema/props.ts+++ b/packages/project-build/src/schema/props.ts@@ -52,6 +52,16 @@ export const Prop = z.union([// data source idvalue: z.string(),}),+ z.object({+ ...baseProp,+ type: z.literal("action"),+ value: z.array(+ z.object({+ type: z.literal("execute"),+ code: z.string(),+ })+ ),+ }),]);export type Prop = z.infer<typeof Prop>;diff --git a/packages/react-sdk/src/context.tsx b/packages/react-sdk/src/context.tsxindex 9a9b0930dd..71e8ee20cc 100644--- a/packages/react-sdk/src/context.tsx+++ b/packages/react-sdk/src/context.tsx@@ -31,13 +31,20 @@ export type Params = {assetBaseUrl: string;};+export type DataSourceValues = Map<DataSource["id"], unknown>;+export const ReactSdkContext = createContext<Params & {propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;assetsStore: ReadableAtom<Assets>;pagesStore: ReadableAtom<Pages>;- dataSourceValuesStore: ReadableAtom<Map<DataSource["id"], unknown>>;- setDataSourceValue: (+ dataSourceValuesStore: ReadableAtom<DataSourceValues>;+ executeEffectfulExpression: (+ expression: string,+ values: DataSourceValues+ ) => DataSourceValues;+ setDataSourceValues: (newValues: DataSourceValues) => void;+ setBoundDataSourceValue: (instanceId: Instance["id"],prop: Prop["name"],value: unknown@@ -50,7 +57,13 @@ export const ReactSdkContext = createContext<assetsStore: atom(new Map()),pagesStore: atom(new Map()),dataSourceValuesStore: atom(new Map()),- setDataSourceValue: () => {- throw Error("React SDK setDataSourceValue is not implemented");+ executeEffectfulExpression: () => {+ throw Error("React SDK executeEffectfulExpression is not implemented");+ },+ setDataSourceValues: () => {+ throw Error("React SDK setBoundDataSourceValue is not implemented");+ },+ setBoundDataSourceValue: () => {+ throw Error("React SDK setBoundDataSourceValue is not implemented");},});diff --git a/packages/react-sdk/src/embed-template.test.ts b/packages/react-sdk/src/embed-template.test.tsindex 56f6ce1161..ad6d87d724 100644--- a/packages/react-sdk/src/embed-template.test.ts+++ b/packages/react-sdk/src/embed-template.test.ts@@ -307,10 +307,7 @@ test("generate data for embedding from props bound to data source expressions",type: "string",name: "state",value: "initial",- dataSourceRef: {- type: "variable",- name: "boxState",- },+ dataSourceRef: { type: "variable", name: "boxState" },},],children: [],@@ -384,3 +381,86 @@ test("generate data for embedding from props bound to data source expressions",styles: [],});});++test("generate data for embedding from action props", () => {+ expect(+ generateDataFromEmbedTemplate(+ [+ {+ type: "instance",+ component: "Box1",+ props: [+ {+ type: "string",+ name: "state",+ value: "initial",+ dataSourceRef: { type: "variable", name: "boxState" },+ },+ ],+ children: [+ {+ type: "instance",+ component: "Box2",+ props: [+ {+ type: "action",+ name: "onClick",+ value: [{ type: "execute", code: `boxState = 'success'` }],+ },+ ],+ children: [],+ },+ ],+ },+ ],+ defaultBreakpointId+ )+ ).toEqual({+ children: [{ type: "id", value: expectString }],+ instances: [+ {+ type: "instance",+ id: expectString,+ component: "Box1",+ children: [{ type: "id", value: expectString }],+ },+ { type: "instance", id: expectString, component: "Box2", children: [] },+ ],+ props: [+ {+ id: expectString,+ instanceId: expectString,+ type: "dataSource",+ name: "state",+ value: expectString,+ },+ {+ id: expectString,+ instanceId: expectString,+ type: "action",+ name: "onClick",+ value: [+ {+ type: "execute",+ code: expect.stringMatching(/\$ws\$dataSource\$\w+ = 'success'/),+ },+ ],+ },+ ],+ dataSources: [+ {+ type: "variable",+ id: expectString,+ scopeInstanceId: expectString,+ name: "boxState",+ value: {+ type: "string",+ value: "initial",+ },+ },+ ],+ styleSourceSelections: [],+ styleSources: [],+ styles: [],+ });+});diff --git a/packages/react-sdk/src/embed-template.ts b/packages/react-sdk/src/embed-template.tsindex ac44ba9dfe..1c634440bb 100644--- a/packages/react-sdk/src/embed-template.ts+++ b/packages/react-sdk/src/embed-template.ts@@ -21,11 +21,13 @@ const EmbedTemplateText = z.object({type EmbedTemplateText = z.infer<typeof EmbedTemplateText>;+const DataSourceVariableRef = z.object({+ type: z.literal("variable"),+ name: z.string(),+});+const DataSourceRef = z.union([- z.object({- type: z.literal("variable"),- name: z.string(),- }),+ DataSourceVariableRef,z.object({type: z.literal("expression"),name: z.string(),@@ -58,6 +60,16 @@ const EmbedTemplateProp = z.union([dataSourceRef: z.optional(DataSourceRef),value: z.array(z.string()),}),+ z.object({+ type: z.literal("action"),+ name: z.string(),+ value: z.array(+ z.object({+ type: z.literal("execute"),+ code: z.string(),+ })+ ),+ }),]);type EmbedTemplateProp = z.infer<typeof EmbedTemplateProp>;@@ -124,6 +136,29 @@ const createInstancesFromTemplate = (if (item.props) {for (const prop of item.props) {const propId = nanoid();+ // action cannot be bound to data source+ if (prop.type === "action") {+ props.push({+ id: propId,+ instanceId,+ type: "action",+ name: prop.name,+ value: prop.value.map((value) => {+ return {+ type: "execute",+ // replace all references with variable names+ code: validateExpression(value.code, {+ effectful: true,+ transformIdentifier: (ref) => {+ const id = dataSourceByRef.get(ref)?.id ?? ref;+ return encodeDataSourceVariable(id);+ },+ }),+ };+ }),+ });+ continue;+ }if (prop.dataSourceRef === undefined) {props.push({ id: propId, instanceId, ...prop });continue;@@ -148,7 +183,13 @@ const createInstancesFromTemplate = (id,scopeInstanceId: instanceId,name: dataSourceRef.name,- code: dataSourceRef.code,+ // replace all references with variable names+ code: validateExpression(dataSourceRef.code, {+ transformIdentifier: (ref) => {+ const id = dataSourceByRef.get(ref)?.id ?? ref;+ return encodeDataSourceVariable(id);+ },+ }),};dataSourceByRef.set(dataSourceRef.name, dataSource);} else {@@ -246,25 +287,11 @@ export const generateDataFromEmbedTemplate = (defaultBreakpointId);- // replace all references with variable names- const dataSources: DataSource[] = [];- for (const dataSource of dataSourceByRef.values()) {- if (dataSource.type === "expression") {- dataSource.code = validateExpression(dataSource.code, {- transformIdentifier: (ref) => {- const id = dataSourceByRef.get(ref)?.id ?? ref;- return encodeDataSourceVariable(id);- },- });- }- dataSources.push(dataSource);- }-return {children,instances,props,- dataSources,+ dataSources: Array.from(dataSourceByRef.values()),styleSourceSelections,styleSources,styles,diff --git a/packages/react-sdk/src/expression.ts b/packages/react-sdk/src/expression.tsindex af86e95158..36c995386b 100644--- a/packages/react-sdk/src/expression.ts+++ b/packages/react-sdk/src/expression.ts@@ -307,6 +307,8 @@ export const executeEffectfulExpression = (return values;};+type Values = Map<string, unknown>;+const dataSourceVariablePrefix = "$ws$dataSource$";// data source id is generated with nanoid which has "-" in alphabeta@@ -318,6 +320,14 @@ export const encodeDataSourceVariable = (id: string) => {return `${dataSourceVariablePrefix}${encoded}`;};+export const encodeVariablesMap = (values: Values) => {+ const encodedValues: Values = new Map();+ for (const [id, value] of values) {+ encodedValues.set(encodeDataSourceVariable(id), value);+ }+ return encodedValues;+};+export const decodeDataSourceVariable = (name: string) => {if (name.startsWith(dataSourceVariablePrefix)) {const encoded = name.slice(dataSourceVariablePrefix.length);@@ -325,3 +335,14 @@ export const decodeDataSourceVariable = (name: string) => {}return;};++export const decodeVariablesMap = (values: Values) => {+ const decodedValues: Values = new Map();+ for (const [name, value] of values) {+ const id = decodeDataSourceVariable(name);+ if (id !== undefined) {+ decodedValues.set(id, value);+ }+ }+ return decodedValues;+};diff --git a/packages/react-sdk/src/index.ts b/packages/react-sdk/src/index.tsindex 5652479769..8c8078b678 100644--- a/packages/react-sdk/src/index.ts+++ b/packages/react-sdk/src/index.ts@@ -27,5 +27,7 @@ export {generateEffectfulExpression,executeEffectfulExpression,encodeDataSourceVariable,+ encodeVariablesMap,decodeDataSourceVariable,+ decodeVariablesMap,} from "./expression";diff --git a/packages/react-sdk/src/props.ts b/packages/react-sdk/src/props.tsindex 867f691961..fabe8c7c0d 100644--- a/packages/react-sdk/src/props.ts+++ b/packages/react-sdk/src/props.ts@@ -26,8 +26,13 @@ export const getPropsByInstanceId = (props: Props) => {// this utility is be used only for preview with static props// so there is no need to use computed to optimize rerendersexport const useInstanceProps = (instanceId: Instance["id"]) => {- const { propsByInstanceIdStore, dataSourceValuesStore } =- useContext(ReactSdkContext);+ const {+ propsByInstanceIdStore,+ dataSourceValuesStore,+ executeEffectfulExpression,+ setDataSourceValues,+ renderer,+ } = useContext(ReactSdkContext);const instancePropsObjectStore = useMemo(() => {return computed([propsByInstanceIdStore, dataSourceValuesStore],@@ -49,12 +54,37 @@ export const useInstanceProps = (instanceId: Instance["id"]) => {}continue;}+ if (prop.type === "action") {+ instancePropsObject[prop.name] = () => {+ // prevent all actions in canvas mode+ if (renderer === "canvas") {+ return;+ }+ for (const value of prop.value) {+ if (value.type === "execute") {+ const newValues = executeEffectfulExpression(+ value.code,+ dataSourceValues+ );+ setDataSourceValues(newValues);+ }+ }+ };+ continue;+ }instancePropsObject[prop.name] = prop.value;}return instancePropsObject;});- }, [propsByInstanceIdStore, dataSourceValuesStore, instanceId]);+ }, [+ propsByInstanceIdStore,+ dataSourceValuesStore,+ instanceId,+ renderer,+ executeEffectfulExpression,+ setDataSourceValues,+ ]);const instancePropsObject = useStore(instancePropsObjectStore);return instancePropsObject;};diff --git a/packages/react-sdk/src/tree/create-elements-tree.tsx b/packages/react-sdk/src/tree/create-elements-tree.tsxindex f45f8b42de..7bc30d3670 100644--- a/packages/react-sdk/src/tree/create-elements-tree.tsx+++ b/packages/react-sdk/src/tree/create-elements-tree.tsx@@ -2,13 +2,13 @@ import { type ComponentProps, Fragment } from "react";import type { ReadableAtom } from "nanostores";import { Scripts, ScrollRestoration } from "@remix-run/react";import type { Assets } from "@webstudio-is/asset-uploader";-import type {- DataSource,- Instance,- Instances,-} from "@webstudio-is/project-build";+import type { Instance, Instances } from "@webstudio-is/project-build";import type { Components } from "../components/components-utils";-import { ReactSdkContext, type Params } from "../context";+import {+ type Params,+ type DataSourceValues,+ ReactSdkContext,+} from "../context";import type { Pages, PropsByInstanceId } from "../props";import type { WebstudioComponent } from "./webstudio-component";@@ -24,6 +24,7 @@ export const createElementsTree = ({assetsStore,pagesStore,dataSourceValuesStore,+ executeEffectfulExpression,onDataSourceUpdate,Component,components,@@ -33,8 +34,12 @@ export const createElementsTree = ({propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;assetsStore: ReadableAtom<Assets>;pagesStore: ReadableAtom<Pages>;- dataSourceValuesStore: ReadableAtom<Map<DataSource["id"], unknown>>;- onDataSourceUpdate: (dataSourceId: DataSource["id"], value: unknown) => void;+ executeEffectfulExpression: (+ expression: string,+ values: DataSourceValues+ ) => DataSourceValues;+ dataSourceValuesStore: ReadableAtom<DataSourceValues>;+ onDataSourceUpdate: (newValues: DataSourceValues) => void;Component: (props: ComponentProps<typeof WebstudioComponent>) => JSX.Element;components: Components;}) => {@@ -74,7 +79,9 @@ export const createElementsTree = ({renderer,imageBaseUrl,assetBaseUrl,- setDataSourceValue: (instanceId, propName, value) => {+ executeEffectfulExpression,+ setDataSourceValues: onDataSourceUpdate,+ setBoundDataSourceValue: (instanceId, propName, value) => {const propsByInstanceId = propsByInstanceIdStore.get();const props = propsByInstanceId.get(instanceId);const prop = props?.find((prop) => prop.name === propName);@@ -82,7 +89,9 @@ export const createElementsTree = ({throw Error(`${propName} is not data source`);}const dataSourceId = prop.value;- onDataSourceUpdate(dataSourceId, value);+ const newValues = new Map();+ newValues.set(dataSourceId, value);+ onDataSourceUpdate(newValues);},}}>diff --git a/packages/react-sdk/src/tree/root.ts b/packages/react-sdk/src/tree/root.tsindex 4c626c0fa7..e750bdd634 100644--- a/packages/react-sdk/src/tree/root.ts+++ b/packages/react-sdk/src/tree/root.ts@@ -1,17 +1,17 @@-import { useRef, type ComponentProps } from "react";+import { useRef, type ComponentProps, useCallback } from "react";import {atom,computed,type ReadableAtom,type WritableAtom,} from "nanostores";-import { type Build, type Page, DataSource } from "@webstudio-is/project-build";+import { type Build, type Page } from "@webstudio-is/project-build";import type { Asset } from "@webstudio-is/asset-uploader";import { createElementsTree } from "./create-elements-tree";import { WebstudioComponent } from "./webstudio-component";import { getPropsByInstanceId } from "../props";import type { Components } from "../components/components-utils";-import type { Params } from "../context";+import type { Params, DataSourceValues } from "../context";export type Data = {page: Page;@@ -25,18 +25,21 @@ export type RootPropsData = Omit<Data, "build"> & {build: Pick<Data["build"], "instances" | "props" | "dataSources">;};-type DataSourceValues = Map<DataSource["id"], unknown>;-type RootProps = {data: RootPropsData;- computeExpressions: (values: DataSourceValues) => DataSourceValues;+ executeComputingExpressions: (values: DataSourceValues) => DataSourceValues;+ executeEffectfulExpression: (+ expression: string,+ values: DataSourceValues+ ) => DataSourceValues;Component?: (props: ComponentProps<typeof WebstudioComponent>) => JSX.Element;components: Components;};export const InstanceRoot = ({data,- computeExpressions,+ executeComputingExpressions,+ executeEffectfulExpression,Component,components,}: RootProps): JSX.Element | null => {@@ -67,7 +70,7 @@ export const InstanceRoot = ({// set expression valuestry {- const result = computeExpressions(dataSourceValues);+ const result = executeComputingExpressions(dataSourceValues);for (const [id, value] of result) {dataSourceValues.set(id, value);}@@ -82,6 +85,17 @@ export const InstanceRoot = ({}const dataSourceValuesStore = dataSourceValuesStoreRef.current;+ const onDataSourceUpdate = useCallback(+ (newValues: DataSourceValues) => {+ const dataSourceVariables = new Map(dataSourceVariablesStore.get());+ for (const [dataSourceId, value] of newValues) {+ dataSourceVariables.set(dataSourceId, value);+ }+ dataSourceVariablesStore.set(dataSourceVariables);+ },+ [dataSourceVariablesStore]+ );+return createElementsTree({imageBaseUrl: data.params?.imageBaseUrl ?? "/",assetBaseUrl: data.params?.assetBaseUrl ?? "/",@@ -92,12 +106,9 @@ export const InstanceRoot = ({),assetsStore: atom(new Map(data.assets.map((asset) => [asset.id, asset]))),pagesStore: atom(new Map(data.pages.map((page) => [page.id, page]))),+ executeEffectfulExpression,dataSourceValuesStore,- onDataSourceUpdate: (dataSourceId, value) => {- const dataSourceVariables = new Map(dataSourceVariablesStore.get());- dataSourceVariables.set(dataSourceId, value);- dataSourceVariablesStore.set(dataSourceVariables);- },+ onDataSourceUpdate,Component: Component ?? WebstudioComponent,components,});diff --git a/packages/sdk-components-react-remix/src/form.tsx b/packages/sdk-components-react-remix/src/form.tsxindex bc2346f2ea..2ddf10ad2b 100644--- a/packages/sdk-components-react-remix/src/form.tsx+++ b/packages/sdk-components-react-remix/src/form.tsx@@ -44,7 +44,7 @@ export const Form = forwardRef<encType?: FormProps["encType"];}>(({ children, action, method, state = "initial", ...rest }, ref) => {- const { setDataSourceValue } = useContext(ReactSdkContext);+ const { setBoundDataSourceValue } = useContext(ReactSdkContext);const fetcher = useFetcher();@@ -52,7 +52,7 @@ export const Form = forwardRef<useOnFetchEnd(fetcher, (data) => {const state: State = data?.success === true ? "success" : "error";- setDataSourceValue(instanceId, "state", state);+ setBoundDataSourceValue(instanceId, "state", state);});return (