Drop active searchable item subscription when changing active item (#4220)
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. Release Notes: - Fixed a performance issue when switching the active item while the search bar was open.
This commit is contained in:
commit
8ce7594a26
1 changed files with 3 additions and 4 deletions
|
@ -396,8 +396,8 @@ impl ToolbarItemView for BufferSearchBar {
|
||||||
{
|
{
|
||||||
let this = cx.view().downgrade();
|
let this = cx.view().downgrade();
|
||||||
|
|
||||||
searchable_item_handle
|
self.active_searchable_item_subscription =
|
||||||
.subscribe_to_search_events(
|
Some(searchable_item_handle.subscribe_to_search_events(
|
||||||
cx,
|
cx,
|
||||||
Box::new(move |search_event, cx| {
|
Box::new(move |search_event, cx| {
|
||||||
if let Some(this) = this.upgrade() {
|
if let Some(this) = this.upgrade() {
|
||||||
|
@ -406,8 +406,7 @@ impl ToolbarItemView for BufferSearchBar {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
));
|
||||||
.detach();
|
|
||||||
|
|
||||||
self.active_searchable_item = Some(searchable_item_handle);
|
self.active_searchable_item = Some(searchable_item_handle);
|
||||||
let _ = self.update_matches(cx);
|
let _ = self.update_matches(cx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue