Fix undismissed app notifications appearing on new workspaces (#24437)
Bug in #23817 Release Notes: - N/A
This commit is contained in:
parent
1f9d02607b
commit
92c21a2814
1 changed files with 5 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
use crate::{Toast, Workspace};
|
use crate::{Toast, Workspace};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
svg, AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent,
|
svg, AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent,
|
||||||
Entity, EventEmitter, Global, PromptLevel, Render, ScrollHandle, Task,
|
Entity, EventEmitter, PromptLevel, Render, ScrollHandle, Task,
|
||||||
};
|
};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use std::sync::{Arc, LazyLock};
|
use std::sync::{Arc, LazyLock};
|
||||||
|
@ -156,10 +156,11 @@ impl Workspace {
|
||||||
|
|
||||||
pub fn show_initial_notifications(&mut self, cx: &mut Context<Self>) {
|
pub fn show_initial_notifications(&mut self, cx: &mut Context<Self>) {
|
||||||
// Allow absence of the global so that tests don't need to initialize it.
|
// Allow absence of the global so that tests don't need to initialize it.
|
||||||
let app_notifications = cx
|
let app_notifications = GLOBAL_APP_NOTIFICATIONS
|
||||||
.try_global::<AppNotifications>()
|
.lock()
|
||||||
|
.app_notifications
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|global| global.app_notifications.iter().cloned())
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
for (id, build_notification) in app_notifications {
|
for (id, build_notification) in app_notifications {
|
||||||
self.show_notification_without_handling_dismiss_events(&id, cx, |cx| {
|
self.show_notification_without_handling_dismiss_events(&id, cx, |cx| {
|
||||||
|
@ -614,8 +615,6 @@ struct AppNotifications {
|
||||||
)>,
|
)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Global for AppNotifications {}
|
|
||||||
|
|
||||||
impl AppNotifications {
|
impl AppNotifications {
|
||||||
pub fn insert(
|
pub fn insert(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue