tauri-apps / tauri-apps/plugins-workspace

[bug][notification][v2] notification disappear almost immediately

Open
#1,562 2 comments 1 reaction 0 assignees View on GitHub
platform: linux plugin: notification status: upstream type: bug
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

Notifications disappear almost immediately after being sent.
In the video, I create a new minimal project with `cargo create-tauri-app --beta` and `cargo tauri add notification`.
I had the following code in `run` function to send test notifications.
```rust
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_shell::init())
.setup(|app| {
use tauri_plugin_notification::NotificationExt;
for i in 1..=10 {
thread::sleep(Duration::from_secs(1));
app.notification()
.builder()
.title("Tauri")
.body(format!("test {}", i))
.show()
.expect("error")
}
Ok(())
})
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```

[Screencast from 2024-07-18 18-26-18.webm](https://github.com/user-attachments/assets/f638cecc-2560-4199-8acb-30026a815ab5)

tauri info
```
[✔] Environment
- OS: Ubuntu 24.4.0 X64
✔ webkit2gtk-4.1: 2.44.2
✔ rsvg2: 2.58.0
✔ rustc: 1.79.0 (129f3b996 2024-06-10)
✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
- node: 20.15.1
- npm: 10.7.0

[-] Packages
- tauri [RUST]: 2.0.0-beta.24
- tauri-build [RUST]: 2.0.0-beta.19
- wry [RUST]: 0.41.0
- tao [RUST]: 0.28.1
- tauri-cli [RUST]: 2.0.0-beta.22
- @tauri-apps/api [NPM]: 2.0.0-beta.15
- @tauri-apps/cli [NPM]: 2.0.0-beta.22

[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- bundler: Vite
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.