Skip to content

Commit 40c1c72

Browse files
authored
Fix notification popup instantly closing (#9923)
### What #9103 broke the notification popup, this is the fix. Seems like `view_space_origin_widget_editing_ui` was also broken, but I'm not sure where that ui is.
1 parent 09e309a commit 40c1c72

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

crates/viewer/re_ui/src/notifications.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,13 @@ impl NotificationUi {
159159
}
160160

161161
fn ui(&mut self, egui_ctx: &egui::Context, button_response: &egui::Response) {
162-
let is_panel_visible =
163-
egui_ctx.memory(|mem| mem.is_popup_open(notification_panel_popup_id()));
162+
let is_panel_visible = egui_ctx.memory_mut(|mem| {
163+
let is_open = mem.is_popup_open(notification_panel_popup_id());
164+
if is_open {
165+
mem.keep_popup_open(notification_panel_popup_id());
166+
}
167+
is_open
168+
});
164169
if is_panel_visible {
165170
// Dismiss all toasts when opening panel
166171
self.unread_notification_level = None;

crates/viewer/re_ui/src/ui_ext.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,13 @@ pub trait UiExt {
318318
) -> Option<R> {
319319
let ui = self.ui();
320320

321-
if !ui.memory(|mem| mem.is_popup_open(popup_id)) {
321+
if !ui.memory_mut(|mem| {
322+
let is_open = mem.is_popup_open(popup_id);
323+
if is_open {
324+
mem.keep_popup_open(popup_id);
325+
}
326+
is_open
327+
}) {
322328
return None;
323329
}
324330

0 commit comments

Comments
 (0)