chore: fix crash on update relays
This commit is contained in:
@@ -188,7 +188,7 @@ impl AppView {
|
|||||||
this.keyboard(false)
|
this.keyboard(false)
|
||||||
.closable(false)
|
.closable(false)
|
||||||
.width(px(420.))
|
.width(px(420.))
|
||||||
.title("Your Messaging Relays is not configured")
|
.title("Your Messaging Relays are not configured")
|
||||||
.child(relays.clone())
|
.child(relays.clone())
|
||||||
.footer(
|
.footer(
|
||||||
div()
|
div()
|
||||||
|
|||||||
@@ -66,13 +66,15 @@ impl Relays {
|
|||||||
|
|
||||||
self.set_loading(true, cx);
|
self.set_loading(true, cx);
|
||||||
|
|
||||||
cx.spawn(|this, mut cx| async move {
|
let client = get_client();
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
|
|
||||||
cx.background_spawn(async move {
|
cx.background_spawn(async move {
|
||||||
let client = get_client();
|
let signer = client.signer().await.expect("Signer is required");
|
||||||
let signer = client.signer().await.unwrap();
|
let public_key = signer
|
||||||
let public_key = signer.get_public_key().await.unwrap();
|
.get_public_key()
|
||||||
|
.await
|
||||||
|
.expect("Cannot get public key");
|
||||||
|
|
||||||
let tags: Vec<Tag> = relays
|
let tags: Vec<Tag> = relays
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -92,15 +94,15 @@ impl Relays {
|
|||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
|
cx.spawn(|this, mut cx| async move {
|
||||||
if rx.await.is_ok() {
|
if rx.await.is_ok() {
|
||||||
cx.update_window(window_handle, |_, window, cx| {
|
_ = cx.update_window(window_handle, |_, window, cx| {
|
||||||
window.close_modal(cx);
|
_ = this.update(cx, |this, cx| {
|
||||||
this.update(cx, |this, cx| {
|
|
||||||
this.set_loading(false, cx);
|
this.set_loading(false, cx);
|
||||||
})
|
});
|
||||||
.unwrap();
|
|
||||||
})
|
window.close_modal(cx);
|
||||||
.unwrap();
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|||||||
Reference in New Issue
Block a user