♻️ (bootsier, htmx): Adapta ciclo de render async
Añade `#[async_trait]` a todos los `impl Extension`, `Theme` y `Component`. Convierte `prepare()` en `async fn` y añade `.await` a las llamadas `render()` y `render_offcanvas()`.
This commit is contained in:
parent
9354894b3a
commit
1139df6210
17 changed files with 68 additions and 42 deletions
|
|
@ -35,6 +35,7 @@ use pagetop::prelude::*;
|
|||
|
||||
struct MyApp;
|
||||
|
||||
#[async_trait]
|
||||
impl Extension for MyApp {
|
||||
fn dependencies(&self) -> Vec<ExtensionRef> {
|
||||
vec![
|
||||
|
|
@ -69,13 +70,13 @@ async fn homepage(request: HttpRequest) -> Result<Markup, ErrorPage> {
|
|||
p { (L10n::l("sample_content").using(cx)) }
|
||||
})),
|
||||
)
|
||||
.render()
|
||||
.render().await
|
||||
}
|
||||
```
|
||||
*/
|
||||
|
||||
#![doc(
|
||||
html_favicon_url = "https://git.cillero.es/manuelcillero/pagetop/raw/branch/main/static/favicon.ico"
|
||||
html_favicon_url = "https://git.cillero.es/manuelcillero/pagetop/raw/branch/main/assets/favicon.ico"
|
||||
)]
|
||||
|
||||
use pagetop::prelude::*;
|
||||
|
|
@ -99,6 +100,7 @@ mod handlers {
|
|||
/// Implementa el tema.
|
||||
pub struct Bootsier;
|
||||
|
||||
#[async_trait]
|
||||
impl Extension for Bootsier {
|
||||
fn name(&self) -> L10n {
|
||||
L10n::t("extension_name", &LOCALES_BOOTSIER)
|
||||
|
|
@ -128,13 +130,14 @@ impl Extension for Bootsier {
|
|||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Theme for Bootsier {
|
||||
#[inline]
|
||||
fn default_template(&self) -> TemplateRef {
|
||||
&BootsierTemplate::Standard
|
||||
}
|
||||
|
||||
fn handle_component(
|
||||
async fn handle_component(
|
||||
&self,
|
||||
component: &mut dyn Component,
|
||||
cx: &mut Context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue