Fix defer handle double lease
Co-Authored-By: Conrad Irwin <conrad@zed.dev>
This commit is contained in:
parent
51ceb52931
commit
29413bc72c
1 changed files with 13 additions and 12 deletions
|
@ -6,9 +6,9 @@ use collections::HashMap;
|
||||||
use db::kvp::KEY_VALUE_STORE;
|
use db::kvp::KEY_VALUE_STORE;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, div, list, px, serde_json, AnyElement, AppContext, AsyncWindowContext, DismissEvent,
|
actions, div, list, px, serde_json, AnyElement, AppContext, AsyncWindowContext, CursorStyle,
|
||||||
Div, Element, EventEmitter, FocusHandle, FocusableView, InteractiveElement, IntoElement,
|
DismissEvent, Div, Element, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
|
||||||
ListAlignment, ListScrollEvent, ListState, Model, ParentElement, Render, Stateful,
|
IntoElement, ListAlignment, ListScrollEvent, ListState, Model, ParentElement, Render, Stateful,
|
||||||
StatefulInteractiveElement, Styled, Task, View, ViewContext, VisualContext, WeakView,
|
StatefulInteractiveElement, Styled, Task, View, ViewContext, VisualContext, WeakView,
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
|
@ -19,10 +19,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use settings::{Settings, SettingsStore};
|
use settings::{Settings, SettingsStore};
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
use time::{OffsetDateTime, UtcOffset};
|
use time::{OffsetDateTime, UtcOffset};
|
||||||
use ui::{
|
use ui::{h_stack, v_stack, Avatar, Button, Clickable, Icon, IconButton, IconElement, Label};
|
||||||
h_stack, v_stack, Avatar, Button, ButtonLike, Clickable, Disableable, Icon, IconButton,
|
|
||||||
IconElement, Label,
|
|
||||||
};
|
|
||||||
use util::{ResultExt, TryFutureExt};
|
use util::{ResultExt, TryFutureExt};
|
||||||
use workspace::{
|
use workspace::{
|
||||||
dock::{DockPosition, Panel, PanelEvent},
|
dock::{DockPosition, Panel, PanelEvent},
|
||||||
|
@ -287,9 +284,13 @@ impl NotificationPanel {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.on_click({
|
.when(can_navigate, |el| {
|
||||||
let notification = notification.clone();
|
el.cursor(CursorStyle::PointingHand).on_click({
|
||||||
cx.listener(move |this, _, cx| this.did_click_notification(¬ification, cx))
|
let notification = notification.clone();
|
||||||
|
cx.listener(move |this, _, cx| {
|
||||||
|
this.did_click_notification(¬ification, cx)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.into_any(),
|
.into_any(),
|
||||||
)
|
)
|
||||||
|
@ -405,7 +406,7 @@ impl NotificationPanel {
|
||||||
} = notification.clone()
|
} = notification.clone()
|
||||||
{
|
{
|
||||||
if let Some(workspace) = self.workspace.upgrade() {
|
if let Some(workspace) = self.workspace.upgrade() {
|
||||||
cx.defer(move |_, cx| {
|
cx.window_context().defer(move |cx| {
|
||||||
workspace.update(cx, |workspace, cx| {
|
workspace.update(cx, |workspace, cx| {
|
||||||
if let Some(panel) = workspace.focus_panel::<ChatPanel>(cx) {
|
if let Some(panel) = workspace.focus_panel::<ChatPanel>(cx) {
|
||||||
panel.update(cx, |panel, cx| {
|
panel.update(cx, |panel, cx| {
|
||||||
|
@ -647,7 +648,7 @@ impl NotificationToast {
|
||||||
fn focus_notification_panel(&self, cx: &mut ViewContext<Self>) {
|
fn focus_notification_panel(&self, cx: &mut ViewContext<Self>) {
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
let notification_id = self.notification_id;
|
let notification_id = self.notification_id;
|
||||||
cx.defer(move |_, cx| {
|
cx.window_context().defer(move |cx| {
|
||||||
workspace
|
workspace
|
||||||
.update(cx, |workspace, cx| {
|
.update(cx, |workspace, cx| {
|
||||||
if let Some(panel) = workspace.focus_panel::<NotificationPanel>(cx) {
|
if let Some(panel) = workspace.focus_panel::<NotificationPanel>(cx) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue