mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-23 14:59:50 +00:00
Drop active searchable item subscription when changing active item
We were leaking the previous active item's subscription, which meant that we would receive the `MatchesInvalidated` event as many times as we changed items. Co-Authored-By: Thorsten Ball <thorsten@zed.dev> Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
21e6b09361
commit
b151e12890
1 changed files with 3 additions and 4 deletions
|
@ -396,8 +396,8 @@ impl ToolbarItemView for BufferSearchBar {
|
|||
{
|
||||
let this = cx.view().downgrade();
|
||||
|
||||
searchable_item_handle
|
||||
.subscribe_to_search_events(
|
||||
self.active_searchable_item_subscription =
|
||||
Some(searchable_item_handle.subscribe_to_search_events(
|
||||
cx,
|
||||
Box::new(move |search_event, cx| {
|
||||
if let Some(this) = this.upgrade() {
|
||||
|
@ -406,8 +406,7 @@ impl ToolbarItemView for BufferSearchBar {
|
|||
});
|
||||
}
|
||||
}),
|
||||
)
|
||||
.detach();
|
||||
));
|
||||
|
||||
self.active_searchable_item = Some(searchable_item_handle);
|
||||
let _ = self.update_matches(cx);
|
||||
|
|
Loading…
Reference in a new issue