Allow subscription/notification to be cancelled by dropping the returned Subscription
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
parent
f4847bd38f
commit
6df80d94ad
@@ -61,7 +61,8 @@ impl ThemeSelector {
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Self {
|
||||
let query_buffer = cx.add_view(|cx| Editor::single_line(settings.clone(), cx));
|
||||
cx.subscribe(&query_buffer, Self::on_query_editor_event);
|
||||
cx.subscribe(&query_buffer, Self::on_query_editor_event)
|
||||
.detach();
|
||||
|
||||
let mut this = Self {
|
||||
settings,
|
||||
@@ -86,7 +87,7 @@ impl ThemeSelector {
|
||||
cx,
|
||||
)
|
||||
});
|
||||
cx.subscribe(&selector, Self::on_event);
|
||||
cx.subscribe(&selector, Self::on_event).detach();
|
||||
selector
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user