mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Fix config.get for schemas containing objects
The config.get method would not return the default values for the properties in objects. Now with _.deepExtends, the default values are the base while any new values overwrite the defaults. This way all default values appear, including those nested in an object. This fixes atom/settings-view#386 and fixes atom/settings-view#518.
This commit is contained in:
committed by
Jeremy Ramin
parent
4560914273
commit
f2c9688b43
@@ -864,8 +864,8 @@ class Config
|
||||
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
|
||||
|
||||
if value?
|
||||
value = @deepClone(value)
|
||||
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
defaultValue = @deepClone(defaultValue)
|
||||
value = _.deepExtends(defaultValue, value) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
else
|
||||
value = @deepClone(defaultValue)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user