diff --git a/Cargo.toml b/Cargo.toml index d4b5497..0f5ee49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] resolver = "2" members = [ + "leptos_viz_macro", "examples/*", ] @@ -19,13 +20,16 @@ tokio = { version = "1", default-features = false } tokio-util = { version = "0.7", features = ["rt"] } leptos_viz = { path = "." } -leptos = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } -leptos_macro = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } -leptos_meta = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } -leptos_router = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } -leptos_reactive = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } -leptos_integration_utils = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } -server_fn = { git = "https://github.com/leptos-rs/leptos.git", rev = "04747fc" } +leptos_viz_macro = { path = "leptos_viz_macro" } + +leptos = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +leptos_macro = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +leptos_meta = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +leptos_router = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +leptos_reactive = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +leptos_integration_utils = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +server_fn = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } +server_fn_macro = { git = "https://github.com/leptos-rs/leptos.git", rev = "b450f0f" } # registration system dashmap = "5" diff --git a/examples/todo_app_sqlite_viz/Cargo.toml b/examples/todo_app_sqlite_viz/Cargo.toml index 1b266a4..5291929 100644 --- a/examples/todo_app_sqlite_viz/Cargo.toml +++ b/examples/todo_app_sqlite_viz/Cargo.toml @@ -26,10 +26,12 @@ http.workspace = true futures.workspace = true leptos.workspace = true leptos_viz = { workspace = true, optional = true } +leptos_viz_macro = { workspace = true } leptos_macro = { workspace = true, features = ["nightly"] } leptos_meta = { workspace = true, features = ["nightly"] } leptos_router = { workspace = true, features = ["nightly"] } leptos_reactive = { workspace = true, features = ["nightly"] } +server_fn = { workspace = true, features = ["ssr", "serde-lite"] } [features] csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr"] diff --git a/examples/todo_app_sqlite_viz/src/todo.rs b/examples/todo_app_sqlite_viz/src/todo.rs index ee06cef..fc7e6e1 100644 --- a/examples/todo_app_sqlite_viz/src/todo.rs +++ b/examples/todo_app_sqlite_viz/src/todo.rs @@ -3,7 +3,9 @@ use cfg_if::cfg_if; use leptos::*; use leptos_meta::*; use leptos_router::*; +use leptos_viz_macro::server; use serde::{Deserialize, Serialize}; +use server_fn::codec::SerdeLite; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[cfg_attr(feature = "ssr", derive(sqlx::FromRow))] @@ -26,14 +28,14 @@ cfg_if! { } } -#[server(GetTodos, "/api")] +#[server] pub async fn get_todos() -> Result, ServerFnError> { // this is just an example of how to access server context injected in the handlers // http::Request doesn't implement Clone, so more work will be needed to do use_context() on this - let req_parts = use_context::(); + let parts = use_context::(); - if let Some(req_parts) = req_parts { - println!("Uri = {:?}", req_parts.uri); + if let Some(parts) = parts { + println!("Uri = {:?}", parts.uri); } use futures::TryStreamExt; @@ -63,7 +65,7 @@ pub async fn get_todos() -> Result, ServerFnError> { Ok(todos) } -#[server(AddTodo, "/api")] +#[server] pub async fn add_todo(title: String) -> Result<(), ServerFnError> { let mut conn = db().await?; @@ -81,7 +83,7 @@ pub async fn add_todo(title: String) -> Result<(), ServerFnError> { } // The struct name and path prefix arguments are optional. -#[server] +#[server(output = SerdeLite)] pub async fn delete_todo(id: u16) -> Result<(), ServerFnError> { let mut conn = db().await?; @@ -97,7 +99,6 @@ pub fn TodoApp() -> impl IntoView { //let id = use_context::(); provide_meta_context(); view! { - @@ -126,7 +127,6 @@ pub fn Todos() -> impl IntoView { ); view! { -