From 8956c7d9c9bf3659396332fb532b963a9e5afb6f Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Mon, 12 Oct 2020 16:27:34 +0100 Subject: [PATCH] fix: Default props were mutated - cause very strange issue with event handlers --- .../components/userInterface/pagesParsing/createProps.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/userInterface/pagesParsing/createProps.js b/packages/builder/src/components/userInterface/pagesParsing/createProps.js index 44d23c5c3e..b628b6e15b 100644 --- a/packages/builder/src/components/userInterface/pagesParsing/createProps.js +++ b/packages/builder/src/components/userInterface/pagesParsing/createProps.js @@ -1,4 +1,4 @@ -import { isString, isUndefined } from "lodash/fp" +import { isString, isUndefined, cloneDeep } from "lodash/fp" import { TYPE_MAP } from "./types" import { assign } from "lodash" import { uuid } from "builderStore/uuid" @@ -83,13 +83,13 @@ const parsePropDef = propDef => { if (isString(propDef)) { if (!TYPE_MAP[propDef]) return error(`Type ${propDef} is not recognised.`) - return TYPE_MAP[propDef].default + return cloneDeep(TYPE_MAP[propDef].default) } const type = TYPE_MAP[propDef.type] if (!type) return error(`Type ${propDef.type} is not recognised.`) - return propDef.default + return cloneDeep(propDef.default) } export const arrayElementComponentName = (parentComponentName, arrayPropName) =>