1
0
Fork 0
mirror of synced 2024-07-03 21:40:55 +12:00

fix: Default props were mutated - cause very strange issue with event handlers

This commit is contained in:
Michael Shanks 2020-10-12 16:27:34 +01:00
parent 45e583dc95
commit 8956c7d9c9

View file

@ -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) =>