🚧 Simplifica preparación opcional
This commit is contained in:
parent
297d1fc338
commit
f87b236659
2 changed files with 5 additions and 13 deletions
|
|
@ -19,7 +19,7 @@ impl<T: ComponentTrait + Default> OneComponent<T> {
|
|||
self.0 = Some(Arc::new(RwLock::new(component)));
|
||||
}
|
||||
|
||||
// OneComponent RENDER.
|
||||
// OneComponent PREPARE.
|
||||
|
||||
pub fn prepare(&self, rcx: &mut RenderContext) -> Markup {
|
||||
if let Some(component) = &self.0 {
|
||||
|
|
@ -27,14 +27,4 @@ impl<T: ComponentTrait + Default> OneComponent<T> {
|
|||
}
|
||||
html! {}
|
||||
}
|
||||
|
||||
pub fn prepare_optional(&self, rcx: &mut RenderContext) -> Option<Markup> {
|
||||
if let Some(component) = &self.0 {
|
||||
let render = component.write().unwrap().prepare(rcx).into_string();
|
||||
if !render.trim().is_empty() {
|
||||
return Some(html! { (render) });
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue