fix
This commit is contained in:
@@ -129,7 +129,7 @@ impl ImportIdentity {
|
||||
})?;
|
||||
}
|
||||
Err(e) => {
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.set_error(e.to_string(), cx);
|
||||
})?;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ impl ImportIdentity {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(3)).await;
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.error.update(cx, |this, cx| {
|
||||
*this = None;
|
||||
cx.notify();
|
||||
@@ -271,7 +271,7 @@ impl Render for ImportIdentity {
|
||||
this.login(window, cx);
|
||||
})),
|
||||
)
|
||||
.when(cfg!(target_arch = "wasm32"), |this| this.child(divider(cx)))
|
||||
.child(divider(cx))
|
||||
.when(!is_wasm, |this| {
|
||||
this.child(
|
||||
Button::new("proxy")
|
||||
|
||||
@@ -83,7 +83,7 @@ impl RestoreEncryption {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(3)).await;
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.error.update(cx, |this, cx| {
|
||||
*this = None;
|
||||
cx.notify();
|
||||
|
||||
@@ -105,7 +105,7 @@ impl Screening {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
let result = task.await.unwrap_or(false);
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.followed = result;
|
||||
cx.notify();
|
||||
})
|
||||
@@ -139,7 +139,7 @@ impl Screening {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
match task.await {
|
||||
Ok(contacts) => {
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.mutual_contacts = contacts;
|
||||
cx.notify();
|
||||
})
|
||||
@@ -185,7 +185,7 @@ impl Screening {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
let result = task.await;
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.last_active = result;
|
||||
cx.notify();
|
||||
})
|
||||
@@ -208,7 +208,7 @@ impl Screening {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
let result = task.await.unwrap_or(false);
|
||||
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.verified = result;
|
||||
cx.notify();
|
||||
})
|
||||
|
||||
@@ -97,7 +97,7 @@ impl BackupPanel {
|
||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||
|
||||
// Clear the error message after a delay
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.set_copied(false, cx);
|
||||
})?;
|
||||
|
||||
|
||||
@@ -108,8 +108,10 @@ impl ContactListPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
let public_keys = task.await?;
|
||||
|
||||
// Update state
|
||||
this.update(cx, |this, cx| {
|
||||
// Update state. `update_in` (rather than `update`) routes through
|
||||
// a try-borrow, so on wasm a poll that happens to land while the
|
||||
// app context is borrowed can't panic and kill this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.contacts.extend(public_keys);
|
||||
cx.notify();
|
||||
})?;
|
||||
@@ -148,8 +150,11 @@ impl ContactListPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||
|
||||
// Clear the error message after a delay
|
||||
this.update(cx, |this, cx| {
|
||||
// Clear the error message after a delay. `update_in` (rather than
|
||||
// `update`) routes through a try-borrow, so on wasm a poll that
|
||||
// happens to land while the app context is borrowed can't panic
|
||||
// and kill this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.error = None;
|
||||
cx.notify();
|
||||
})?;
|
||||
|
||||
@@ -103,8 +103,10 @@ impl MessagingRelayPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
let relays = task.await?;
|
||||
|
||||
// Update state
|
||||
this.update(cx, |this, cx| {
|
||||
// Update state. `update_in` (rather than `update`) routes through
|
||||
// a try-borrow: on wasm a poll that lands while the app context
|
||||
// is borrowed can't panic and kill this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.relays.extend(relays);
|
||||
cx.notify();
|
||||
})?;
|
||||
@@ -148,8 +150,11 @@ impl MessagingRelayPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||
|
||||
// Clear the error message after a delay
|
||||
this.update(cx, |this, cx| {
|
||||
// Clear the error message after a delay. `update_in` (rather than
|
||||
// `update`) routes through a try-borrow: on wasm a poll that
|
||||
// lands while the app context is borrowed can't panic and kill
|
||||
// this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.error = None;
|
||||
cx.notify();
|
||||
})?;
|
||||
|
||||
@@ -167,7 +167,7 @@ impl ProfilePanel {
|
||||
});
|
||||
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
this.update(cx, |this, cx| {
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.set_uploading(true, cx);
|
||||
})?;
|
||||
|
||||
|
||||
@@ -121,8 +121,10 @@ impl RelayListPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
let relays = task.await?;
|
||||
|
||||
// Update state
|
||||
this.update(cx, |this, cx| {
|
||||
// Update state. `update_in` (rather than `update`) routes through
|
||||
// a try-borrow: on wasm a poll that lands while the app context
|
||||
// is borrowed can't panic and kill this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.relays.extend(relays);
|
||||
cx.notify();
|
||||
})?;
|
||||
@@ -167,8 +169,11 @@ impl RelayListPanel {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
cx.background_executor().timer(Duration::from_secs(2)).await;
|
||||
|
||||
// Clear the error message after a delay
|
||||
this.update(cx, |this, cx| {
|
||||
// Clear the error message after a delay. `update_in` (rather than
|
||||
// `update`) routes through a try-borrow: on wasm a poll that
|
||||
// lands while the app context is borrowed can't panic and kill
|
||||
// this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.error = None;
|
||||
cx.notify();
|
||||
})?;
|
||||
|
||||
@@ -178,7 +178,10 @@ impl Sidebar {
|
||||
self.tasks.push(cx.spawn_in(window, async move |this, cx| {
|
||||
match task.await {
|
||||
Ok(contacts) => {
|
||||
this.update(cx, |this, cx| {
|
||||
// `update_in` (rather than `update`) routes through a
|
||||
// try-borrow: on wasm a poll that lands while the app
|
||||
// context is borrowed can't panic and kill this task.
|
||||
this.update_in(cx, |this, _window, cx| {
|
||||
this.set_contact_list(contacts, cx);
|
||||
})?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user