diff --git a/crates/story/src/dropdown_story.rs b/crates/story/src/dropdown_story.rs index 8517a78e..4cf0b83c 100644 --- a/crates/story/src/dropdown_story.rs +++ b/crates/story/src/dropdown_story.rs @@ -116,7 +116,6 @@ impl DropdownStory { .justify_center() .text_color(cx.theme().muted_foreground) .child("No Data") - .into_any_element() }) }), } diff --git a/crates/ui/src/dropdown.rs b/crates/ui/src/dropdown.rs index aa8bbffe..bcd2e9d8 100644 --- a/crates/ui/src/dropdown.rs +++ b/crates/ui/src/dropdown.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, rc::Rc}; +use std::borrow::Cow; use gpui::{ actions, deferred, div, prelude::FluentBuilder, px, rems, AnyElement, AppContext, ClickEvent, @@ -184,7 +184,7 @@ pub struct Dropdown { placeholder: SharedString, title_prefix: Option, selected_value: Option<::Value>, - render_empty: Option AnyElement + 'static>>, + render_empty: Option AnyElement + 'static>>, } impl Dropdown @@ -247,11 +247,12 @@ where self } - pub fn render_empty(mut self, f: F) -> Self + pub fn render_empty(mut self, f: F) -> Self where - F: Fn(&WindowContext) -> AnyElement + 'static, + E: IntoElement, + F: Fn(&WindowContext) -> E + 'static, { - self.render_empty = Some(Rc::new(f)); + self.render_empty = Some(Box::new(move |cx| f(cx).into_any_element())); self }