feat(config): avoid updating blank fields

This commit is contained in:
ItzCrazyKns 2024-04-23 16:54:39 +05:30
parent b2b1d724ee
commit 7653eaf146
No known key found for this signature in database
GPG Key ID: 8162927C7CCE3065
1 changed files with 6 additions and 2 deletions

View File

@ -55,11 +55,15 @@ export const updateConfig = (config: RecursivePartial<Config>) => {
if (currentConfig[key] && typeof currentConfig[key] === 'object') { if (currentConfig[key] && typeof currentConfig[key] === 'object') {
for (const nestedKey in currentConfig[key]) { for (const nestedKey in currentConfig[key]) {
if (currentConfig[key][nestedKey] && !config[key][nestedKey]) { if (
currentConfig[key][nestedKey] &&
!config[key][nestedKey] &&
config[key][nestedKey] !== ''
) {
config[key][nestedKey] = currentConfig[key][nestedKey]; config[key][nestedKey] = currentConfig[key][nestedKey];
} }
} }
} else if (currentConfig[key] && !config[key]) { } else if (currentConfig[key] && !config[key] && config[key] !== '') {
config[key] = currentConfig[key]; config[key] = currentConfig[key];
} }
} }