Skip to content

Commit 794af77

Browse files
fix(cli): merge config based on the first one (#13117)
* fix(cli): merge config based on the first one * Add change file
1 parent 4e22ae2 commit 794af77

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tauri-cli: patch:bug
3+
"@tauri-apps/cli": patch:bug
4+
---
5+
6+
Fix setting merge config value to null with `--config` arg no longer works

crates/tauri-cli/src/helpers/config.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,16 @@ fn get_internal(
164164
}
165165

166166
if !merge_configs.is_empty() {
167-
let mut merge_config = serde_json::Value::Object(Default::default());
168-
for conf in merge_configs {
167+
// We have check merge config is not empty above
168+
let mut merge_config = merge_configs[0].clone();
169+
for conf in merge_configs.iter().skip(1) {
169170
merge(&mut merge_config, conf);
170171
}
171172

172173
let merge_config_str = serde_json::to_string(&merge_config).unwrap();
173174
set_var("TAURI_CONFIG", merge_config_str);
174175
merge(&mut config, &merge_config);
175-
extensions.insert(MERGE_CONFIG_EXTENSION_NAME.into(), merge_config.clone());
176+
extensions.insert(MERGE_CONFIG_EXTENSION_NAME.into(), merge_config);
176177
}
177178

178179
if config_path.extension() == Some(OsStr::new("json"))
@@ -253,8 +254,9 @@ pub fn merge_with(merge_configs: &[&serde_json::Value]) -> crate::Result<ConfigH
253254
}
254255

255256
if let Some(config_metadata) = &mut *handle.lock().unwrap() {
256-
let mut merge_config = serde_json::Value::Object(Default::default());
257-
for conf in merge_configs {
257+
// We have check merge config is not empty above
258+
let mut merge_config = merge_configs[0].clone();
259+
for conf in merge_configs.iter().skip(1) {
258260
merge(&mut merge_config, conf);
259261
}
260262

0 commit comments

Comments
 (0)