From 79c12c01298fa8b40d5f590441f454aa2f6efc75 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Sun, 23 Apr 2023 17:33:45 -0400 Subject: [PATCH] examples: better practice for view types in todos (#940) --- examples/todo_app_sqlite/src/todo.rs | 6 +++--- examples/todo_app_sqlite_axum/src/todo.rs | 6 +++--- examples/todo_app_sqlite_viz/src/todo.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/todo_app_sqlite/src/todo.rs b/examples/todo_app_sqlite/src/todo.rs index 7dc728a20..ee2f46a0f 100644 --- a/examples/todo_app_sqlite/src/todo.rs +++ b/examples/todo_app_sqlite/src/todo.rs @@ -156,11 +156,11 @@ pub fn Todos(cx: Scope) -> impl IntoView { todos.read(cx) .map(move |todos| match todos { Err(e) => { - vec![view! { cx,
"Server Error: " {e.to_string()}
}.into_any()] + view! { cx,
"Server Error: " {e.to_string()}
}.into_view(cx) } Ok(todos) => { if todos.is_empty() { - vec![view! { cx,

"No tasks were found."

}.into_any()] + view! { cx,

"No tasks were found."

}.into_view(cx) } else { todos .into_iter() @@ -175,9 +175,9 @@ pub fn Todos(cx: Scope) -> impl IntoView { } - .into_any() }) .collect::>() + .into_view(cx) } } }) diff --git a/examples/todo_app_sqlite_axum/src/todo.rs b/examples/todo_app_sqlite_axum/src/todo.rs index d2c9ad5c1..e4f102f40 100644 --- a/examples/todo_app_sqlite_axum/src/todo.rs +++ b/examples/todo_app_sqlite_axum/src/todo.rs @@ -209,11 +209,11 @@ pub fn Todos(cx: Scope) -> impl IntoView { todos.read(cx) .map(move |todos| match todos { Err(e) => { - vec![view! { cx,
"Server Error: " {e.to_string()}
}.into_any()] + view! { cx,
"Server Error: " {e.to_string()}
}.into_view(cx) } Ok(todos) => { if todos.is_empty() { - vec![view! { cx,

"No tasks were found."

}.into_any()] + view! { cx,

"No tasks were found."

}.into_view(cx) } else { todos .into_iter() @@ -228,9 +228,9 @@ pub fn Todos(cx: Scope) -> impl IntoView { } - .into_any() }) .collect::>() + .into_view(cx) } } }) diff --git a/examples/todo_app_sqlite_viz/src/todo.rs b/examples/todo_app_sqlite_viz/src/todo.rs index fdfd36e2a..a32ca3e40 100644 --- a/examples/todo_app_sqlite_viz/src/todo.rs +++ b/examples/todo_app_sqlite_viz/src/todo.rs @@ -163,11 +163,11 @@ pub fn Todos(cx: Scope) -> impl IntoView { todos.read(cx) .map(move |todos| match todos { Err(e) => { - vec![view! { cx,
"Server Error: " {e.to_string()}
}.into_any()] + view! { cx,
"Server Error: " {e.to_string()}
}.into_view(cx) } Ok(todos) => { if todos.is_empty() { - vec![view! { cx,

"No tasks were found."

}.into_any()] + view! { cx,

"No tasks were found."

}.into_view(cx) } else { todos .into_iter() @@ -182,9 +182,9 @@ pub fn Todos(cx: Scope) -> impl IntoView { } - .into_any() }) .collect::>() + .into_view(cx) } } })