fix: configs with undefined default values shouldn't save in config.yaml as null

Massimo Melina committed Jan 25, 2023 at 10:48 UTC 623d69c3e541f5b1ce99021f62eed3edb32d849b
1 file changed +2 -1
src/config.ts
+2 -1
@@ -145,7 +145,8 @@ export function setConfig(newCfg: Record<string,any>, save?: boolean) {
145 function setConfig1(k: string, newV: any, saveChanges=true) {
146 if (_.isPlainObject(newV))
147 newV = _.pickBy(newV, x => x !== undefined)
148 - if (same(newV, configProps[k]?.defaultValue))
148 + const def = configProps[k]?.defaultValue
149 + if (same(newV ?? null, def ?? null))
150 newV = undefined
151 if (started && same(newV, state[k])) return // no change
152 const was = getConfig(k) // include cloned default, if necessary