diff --git a/ui-gpui/src/components/blink_state.rs b/ui-gpui/src/components/blink_state.rs index 420e65a..2dbc3ad 100644 --- a/ui-gpui/src/components/blink_state.rs +++ b/ui-gpui/src/components/blink_state.rs @@ -17,17 +17,23 @@ impl BlinkState { Self { visible: true, epoch: 0 } } - pub fn start(entity: &Entity, cx: &mut App) { + pub fn start_from_context(entity: &Entity, cx: &mut Context) { let weak = entity.downgrade(); - cx.spawn(async move |cx: &mut AsyncApp| { + eprintln!("[BlinkState] Starting blink timer"); + cx.spawn(async move |_parent: WeakEntity, cx: &mut AsyncApp| { + eprintln!("[BlinkState] Spawn executing — entering blink loop"); loop { cx.background_executor().timer(Duration::from_millis(500)).await; let ok = weak.update(cx, |state, cx| { state.visible = !state.visible; state.epoch += 1; + eprintln!("[BlinkState] Toggled visible={}", state.visible); cx.notify(); }); - if ok.is_err() { break; } + if ok.is_err() { + eprintln!("[BlinkState] Entity dropped, stopping blink"); + break; + } } }).detach(); } diff --git a/ui-gpui/src/components/project_box.rs b/ui-gpui/src/components/project_box.rs index a93c266..822498f 100644 --- a/ui-gpui/src/components/project_box.rs +++ b/ui-gpui/src/components/project_box.rs @@ -110,7 +110,7 @@ impl ProjectBox { let should_pulse = matches!(self.project.agent.status, AgentStatus::Running); if should_pulse { let blink = cx.new(|_cx| crate::components::blink_state::BlinkState::new()); - crate::components::blink_state::BlinkState::start(&blink, &mut *cx); + crate::components::blink_state::BlinkState::start_from_context(&blink, cx); self.blink_state = Some(blink); } @@ -132,6 +132,9 @@ impl ProjectBox { impl Render for ProjectBox { fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { + eprintln!("[ProjectBox::render] {} blink_visible={:?}", + self.project.name, + self.blink_state.as_ref().map(|bs| bs.read(cx).visible)); let accent = accent_color(self.project.accent_index); let active_tab = self.project.active_tab; diff --git a/ui-gpui/src/workspace.rs b/ui-gpui/src/workspace.rs index b7e4329..19d8202 100644 --- a/ui-gpui/src/workspace.rs +++ b/ui-gpui/src/workspace.rs @@ -96,7 +96,11 @@ impl Render for Workspace { } // Project grid (fills remaining space) — cached with flex-1 - main_row = main_row.child(self.project_grid.clone().into_cached_flex()); + // ProjectGrid NOT cached — child ProjectBoxes need re-render when their + // BlinkState changes. Caching the grid blocks child dirty propagation. + main_row = main_row.child( + div().flex_1().h_full().child(self.project_grid.clone()), + ); root = root.child(main_row);