Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Fix `testing` example not notifying after async task (#66599)

Max Kamps416cd8496390
diff --git a/crates/gpui/examples/testing.rs b/crates/gpui/examples/testing.rs
index 76e3b77352d..13e6e86371c 100644
--- a/crates/gpui/examples/testing.rs
+++ b/crates/gpui/examples/testing.rs
@@ -56,8 +56,9 @@ impl Counter {
fn load(&self, cx: &mut Context<Self>) -> Task<()> {
cx.spawn(async move |this, cx| {
// Simulate loading data (e.g., from disk or network)
- this.update(cx, |counter, _| {
+ this.update(cx, |counter, cx| {
counter.count = 100;
+ cx.notify();
})
.ok();
})
@@ -66,8 +67,9 @@ impl Counter {
fn reload(&self, cx: &mut Context<Self>) {
cx.spawn(async move |this, cx| {
// Simulate reloading data in the background
- this.update(cx, |counter, _| {
+ this.update(cx, |counter, cx| {
counter.count += 50;
+ cx.notify();
})
.ok();
})