fix: a few regressions from previous PRs - #10
Conversation
There was a problem hiding this comment.
Pull request overview
Addresses regressions introduced by prior PRs around new-window handling, window feature propagation, and cookie API exposure/dispatch.
Changes:
- Moves the
on_new_windowexample wiring under#[cfg(all(desktop, not(test)))]and updates it to the renamed window-features builder API. - Renames the
WebviewWindowBuilderwindow-features API and updates docs/usages accordingly. - Adjusts cookie type exposure in
tauri::webviewand modifies cookie dispatch in the Wry runtime.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| examples/api/src-tauri/src/lib.rs | Updates the API example to configure on_new_window only on desktop and use the updated window-features builder call. |
| crates/tauri/src/webview/webview_window.rs | Renames window-features builder API and updates documentation/example usage; adjusts feature application order. |
| crates/tauri/src/webview/mod.rs | Re-exports Cookie from tauri_runtime and updates example to the renamed window-features builder call. |
| crates/tauri-runtime-wry/src/lib.rs | Changes how cookie deletion is dispatched from the Wry webview dispatcher. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| *self.window_id.lock().unwrap(), | ||
| self.webview_id, | ||
| WebviewMessage::DeleteCookie(cookie.clone().into_owned()), | ||
| WebviewMessage::SetCookie(cookie.into_owned()), |
There was a problem hiding this comment.
delete_cookie is dispatching WebviewMessage::SetCookie(...) instead of WebviewMessage::DeleteCookie(...), so callers will set the cookie rather than remove it. Switch the dispatched message variant to DeleteCookie to match the handler logic and the method name.
| WebviewMessage::SetCookie(cookie.into_owned()), | |
| WebviewMessage::DeleteCookie(cookie.into_owned()), |
| @@ -1312,13 +1312,13 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> { | |||
| target_os = "netbsd", | |||
| target_os = "openbsd" | |||
| ))] | |||
There was a problem hiding this comment.
This renames/removes the public builder API with_window_features to window_features. In a 2.x crate, removing a public method is a breaking change for downstream users. Consider keeping with_window_features as a deprecated wrapper that forwards to window_features (and update docs/examples to prefer the new name).
| ))] | |
| ))] | |
| #[deprecated( | |
| since = "2.0.0", | |
| note = "Use `WindowBuilder::window_features` instead" | |
| )] | |
| pub fn with_window_features(self, features: NewWindowFeatures) -> Self { | |
| self.window_features(features) | |
| } | |
| /// Set the window features. | |
| /// Useful if you need to share the same window features, for instance when using the [`Self::on_new_window`]. | |
| #[cfg(any( | |
| target_os = "macos", | |
| windows, | |
| target_os = "linux", | |
| target_os = "dragonfly", | |
| target_os = "freebsd", | |
| target_os = "netbsd", | |
| target_os = "openbsd" | |
| ))] |
| self.window_builder = self.window_builder.position(position.x, position.y); | ||
| pub fn window_features(mut self, features: NewWindowFeatures) -> Self { | ||
| if let Some(size) = features.size() { | ||
| self.window_builder = self.window_builder.inner_size(size.width, size.height); |
There was a problem hiding this comment.
This line appears to have formatting that will fail cargo fmt -- --check (extra spaces between arguments). Please run rustfmt or adjust spacing so the file is formatted consistently.
| if let Some(size) = features.size() { | ||
| self.window_builder = self.window_builder.inner_size(size.width, size.height); | ||
| if let Some(position) = features.position() { | ||
| self.window_builder = self.window_builder.position(position.x,position.y); |
There was a problem hiding this comment.
This call is missing spaces after the comma separators, which will be changed by rustfmt and can cause cargo fmt -- --check to fail. Please run rustfmt or adjust spacing.
Benchmark PR from agentic-review-benchmarks#10