Fix lag when interacting with MarkdownElement (#31585)

Previously, we forgot to associate the `Markdown` entity to
`MarkdownElement` during `prepaint`. This caused calls to
`Context<Markdown>::notify` to not invalidate the view cache, which
meant we would have to wait for some other invalidation before seeing
the results of that initial notify.

Release Notes:

- Improved responsiveness of mouse interactions with the agent panel.

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
Antonio Scandurra 2025-05-28 14:50:45 +02:00 committed by GitHub
parent fee6f13887
commit 957e4adc3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1209,6 +1209,7 @@ impl Element for MarkdownElement {
) -> Self::PrepaintState {
let focus_handle = self.markdown.read(cx).focus_handle.clone();
window.set_focus_handle(&focus_handle, cx);
window.set_view_id(self.markdown.entity_id());
let hitbox = window.insert_hitbox(bounds, false);
rendered_markdown.element.prepaint(window, cx);