🐎 wrap loop of setDefaults in transact

This commit is contained in:
Yuya Tanaka
2016-03-20 14:54:22 +09:00
parent 39592599b1
commit 6d0c708a7b

View File

@@ -958,9 +958,10 @@ class Config
setDefaults: (keyPath, defaults) ->
if defaults? and isPlainObject(defaults)
keys = splitKeyPath(keyPath)
for key, childValue of defaults
continue unless defaults.hasOwnProperty(key)
@setDefaults(keys.concat([key]).join('.'), childValue)
@transact =>
for key, childValue of defaults
continue unless defaults.hasOwnProperty(key)
@setDefaults(keys.concat([key]).join('.'), childValue)
else
try
defaults = @makeValueConformToSchema(keyPath, defaults)