Skip to content

Commit c119060

Browse files
authored
refactor(core): empty default value for config > tauri > windows (#3380)
1 parent e61162a commit c119060

2 files changed

Lines changed: 10 additions & 34 deletions

File tree

.changes/remove-window-default.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch
3+
"tauri-utils": patch
4+
---
5+
6+
**Breaking change*** Remove default webview window when `tauri.conf.json > tauri > windows` is not set.

core/tauri-utils/src/config.rs

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,10 +1454,6 @@ impl Allowlist for AllowlistConfig {
14541454
}
14551455
}
14561456

1457-
fn default_window_config() -> Vec<WindowConfig> {
1458-
vec![Default::default()]
1459-
}
1460-
14611457
/// The application pattern.
14621458
#[skip_serializing_none]
14631459
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
@@ -1490,7 +1486,7 @@ pub struct TauriConfig {
14901486
#[serde(default)]
14911487
pub pattern: PatternKind,
14921488
/// The windows configuration.
1493-
#[serde(default = "default_window_config")]
1489+
#[serde(default)]
14941490
pub windows: Vec<WindowConfig>,
14951491
/// The CLI configuration.
14961492
pub cli: Option<CliConfig>,
@@ -1517,7 +1513,7 @@ impl Default for TauriConfig {
15171513
fn default() -> Self {
15181514
Self {
15191515
pattern: Default::default(),
1520-
windows: default_window_config(),
1516+
windows: Default::default(),
15211517
cli: None,
15221518
bundle: BundleConfig::default(),
15231519
allowlist: AllowlistConfig::default(),
@@ -2544,9 +2540,7 @@ mod test {
25442540
// get default dev path
25452541
let d_path = default_dev_path();
25462542
// get default window
2547-
let d_windows = default_window_config();
2548-
// get default title
2549-
let d_title = default_title();
2543+
let d_windows: Vec<WindowConfig> = vec![];
25502544
// get default bundle
25512545
let d_bundle = BundleConfig::default();
25522546
// get default updater
@@ -2555,30 +2549,7 @@ mod test {
25552549
// create a tauri config.
25562550
let tauri = TauriConfig {
25572551
pattern: Default::default(),
2558-
windows: vec![WindowConfig {
2559-
label: "main".to_string(),
2560-
url: WindowUrl::default(),
2561-
file_drop_enabled: true,
2562-
center: false,
2563-
x: None,
2564-
y: None,
2565-
width: 800f64,
2566-
height: 600f64,
2567-
min_width: None,
2568-
min_height: None,
2569-
max_width: None,
2570-
max_height: None,
2571-
resizable: true,
2572-
title: String::from("Tauri App"),
2573-
fullscreen: false,
2574-
focus: false,
2575-
transparent: false,
2576-
maximized: false,
2577-
visible: true,
2578-
decorations: true,
2579-
always_on_top: false,
2580-
skip_taskbar: false,
2581-
}],
2552+
windows: vec![],
25822553
bundle: BundleConfig {
25832554
active: false,
25842555
targets: None,
@@ -2635,7 +2606,6 @@ mod test {
26352606
Url::parse("http://localhost:8080").unwrap()
26362607
))
26372608
);
2638-
assert_eq!(d_title, tauri.windows[0].title);
26392609
assert_eq!(d_windows, tauri.windows);
26402610
}
26412611
}

0 commit comments

Comments
 (0)