fix: Default props were mutated - cause very strange issue with event handlers
This commit is contained in:
parent
98138296c7
commit
376b8b40d7
|
@ -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) =>
|
||||
|
|
Loading…
Reference in New Issue