Skip to content

Commit ef4bbe7

Browse files
committed
Bug: form objects with same key shared instance
Due to a less optimal use of angular.extend. This could for instance make to form objects with key and condition behave badly
1 parent c04af3f commit ef4bbe7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/services/schema-form.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,15 @@ angular.module('schemaForm').provider('schemaForm',
351351
}
352352

353353
//extend with std form from schema.
354-
355354
if (obj.key) {
356355
var strid = sfPathProvider.stringify(obj.key);
357356
if (lookup[strid]) {
358-
obj = angular.extend(lookup[strid], obj);
357+
var schemaDefaults = lookup[strid];
358+
angular.forEach(schemaDefaults, function(value, attr) {
359+
if (obj[attr] === undefined) {
360+
obj[attr] = schemaDefaults[attr];
361+
}
362+
});
359363
}
360364
}
361365

0 commit comments

Comments
 (0)