|
@@ -457,13 +457,15 @@ const execMetaReorderingInstructions = (metaG: StringMap<any>) => {
|
|
|
// (used to produce an updated copy of a model when form values are changed - will not create new keys)
|
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
+const isRealObject = val => val !== null && typeof val === 'object'; // js quirk - typeof null ---> 'object'
|
|
|
+
|
|
|
const generateNewModel = (originalModel, updates) => {
|
|
|
return updateObject(originalModel, updates);
|
|
|
};
|
|
|
|
|
|
const updateObject = (obj, updates, createAdditionalKeys = false) => {
|
|
|
// THIS DOES NOT MUTATE obj, instead returning a new object
|
|
|
- if (typeof obj !== 'object') {
|
|
|
+ if (!isRealObject(obj)) {
|
|
|
obj = {};
|
|
|
}
|
|
|
console.log('obj is', obj, typeof obj);
|