Remove unconditional invalidation when calling mouse region handlers

Nathan Sobo created

We want invalidation to opt-in as much as possible.
If you want a view to re-render, you need to call `cx.notify`.

Change summary

crates/editor/src/hover_popover.rs | 4 ++--
crates/gpui/src/elements/list.rs   | 2 ++
crates/gpui/src/presenter.rs       | 3 ---
3 files changed, 4 insertions(+), 5 deletions(-)

Detailed changes

crates/editor/src/hover_popover.rs 🔗

@@ -354,7 +354,7 @@ impl InfoPopover {
                 .with_style(style.hover_popover.container)
                 .boxed()
         })
-        .on_move(|_, _| {})
+        .on_move(|_, _| {}) // Consume move events so they don't reach regions underneath.
         .with_cursor_style(CursorStyle::Arrow)
         .with_padding(Padding {
             bottom: HOVER_POPOVER_GAP,
@@ -400,7 +400,7 @@ impl DiagnosticPopover {
             bottom: HOVER_POPOVER_GAP,
             ..Default::default()
         })
-        .on_move(|_, _| {})
+        .on_move(|_, _| {}) // Consume move events so they don't reach regions underneath.
         .on_click(MouseButton::Left, |_, cx| {
             cx.dispatch_action(GoToDiagnostic)
         })

crates/gpui/src/elements/list.rs 🔗

@@ -558,6 +558,8 @@ impl StateInner {
             let visible_range = self.visible_range(height, scroll_top);
             self.scroll_handler.as_mut().unwrap()(visible_range, cx);
         }
+
+        cx.notify();
     }
 
     fn scroll_top(&self, logical_scroll_top: &ListOffset) -> f32 {

crates/gpui/src/presenter.rs 🔗

@@ -482,9 +482,6 @@ impl Presenter {
 
                     if let Some(callback) = valid_region.handlers.get(&region_event.handler_key()) {
                         event_cx.handled = true;
-                        event_cx
-                            .invalidated_views
-                            .insert(valid_region.id().view_id());
                         event_cx.with_current_view(valid_region.id().view_id(), {
                             let region_event = region_event.clone();
                             |cx| {