-
Notifications
You must be signed in to change notification settings - Fork 5.6k
fix(desktop): add missing StoreExt import and fix unused mut warning #7707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(desktop): add missing StoreExt import and fix unused mut warning #7707
Conversation
Fixes anomalyco#7706 - Add missing 'use tauri_plugin_store::StoreExt' import to enable .store() method on AppHandle - Fix unused_mut warning on window_builder by using variable shadowing for macOS config The StoreExt trait must be in scope to use the .store() method on AppHandle. Without this import, compilation fails with E0599 errors at lines 98, 111, and 254.
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a compilation error in the desktop app caused by a missing StoreExt trait import and addresses an unused mut warning on the window_builder variable.
Changes:
- Added
use tauri_plugin_store::StoreExt;import to enable.store()method calls onAppHandle - Removed
mutfromwindow_builderand used variable shadowing for macOS-specific configuration
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #[cfg(target_os = "macos")] | ||
| { | ||
| window_builder = window_builder | ||
| .title_bar_style(tauri::TitleBarStyle::Overlay) | ||
| .hidden_title(true); | ||
| } | ||
| let window_builder = window_builder | ||
| .title_bar_style(tauri::TitleBarStyle::Overlay) | ||
| .hidden_title(true); |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional compilation directive #[cfg(target_os = "macos")] is only applied to the line immediately following it. In the original code, it guarded a block containing the window_builder reassignment. By removing the braces, the macOS-specific title bar style and hidden title configuration will now be applied on all platforms (Windows, Linux, etc.), not just macOS. This will cause incorrect window styling on non-macOS platforms. The braces should be retained to properly scope the conditional compilation, or the #[cfg(target_os = "macos")] directive needs to be applied to each method call individually.
The previous fix incorrectly removed braces around the macOS-specific window configuration, causing #[cfg(target_os = "macos")] to only apply to the let binding. This would have caused the title bar style and hidden title settings to be applied on all platforms. This commit: - Restores the braces to properly scope the conditional block - Adds #[allow(unused_mut)] to suppress the warning since window_builder is only mutated on macOS Fixes review feedback on PR anomalyco#7707
|
Thanks for catching that! You're absolutely right - removing the braces broke the conditional compilation scope. I've fixed this in commit 8a65111 by:
The macOS-specific title bar configuration now correctly applies only on macOS platforms. |
Summary
Fixes #7706
This PR resolves compilation errors in the desktop app caused by a missing trait import.
Changes
use tauri_plugin_store::StoreExt;import (line 19)mutwarning onwindow_builderby adding#[allow(unused_mut)]attributeProblem
The desktop app failed to compile with three E0599 errors:
This occurred at lines 98, 111, and 254 where
.store()was called onAppHandle.Additionally, there was an unused
mutwarning onwindow_buildersince it's only mutated on macOS.Solution
StoreExt import: According to the tauri-plugin-store documentation, the
StoreExttrait must be in scope to use the.store()method onAppHandle.Conditional compilation: The
window_builderis declared asmutwith#[allow(unused_mut)]since it's only mutated within the#[cfg(target_os = "macos")]block. The macOS-specific configuration is properly scoped with braces to ensure the conditional compilation applies to the entire block, not just the first line.Verification
✅ Compilation succeeds with Rust 1.90.0+ after applying this fix
✅ All TypeScript checks pass
✅ Solution confirmed against official tauri-plugin-store documentation
✅ macOS-specific window configuration correctly scoped to prevent applying on other platforms
The fix is minimal, focused, and follows both the official Tauri plugin usage pattern and Rust conditional compilation best practices.