Skip to content

Commit

Permalink
feat: make Transition set_pending use #[prop(into)] (#1746)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj authored Sep 19, 2023
1 parent 661a038 commit 1bd47f3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/hackernews/src/routes/stories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn Stories() -> impl IntoView {
<div>
<Transition
fallback=move || view! { <p>"Loading..."</p> }
set_pending=set_pending.into()
set_pending
>
{move || match stories.get() {
None => None,
Expand Down
4 changes: 2 additions & 2 deletions examples/hackernews_axum/src/routes/stories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn Stories() -> impl IntoView {
>
<a href=move || format!("/{}?page={}", story_type(), page() + 1)
aria-label="Next Page"
>
>=
"more >"
</a>
</span>
Expand All @@ -79,7 +79,7 @@ pub fn Stories() -> impl IntoView {
<div>
<Transition
fallback=move || view! { <p>"Loading..."</p> }
set_pending=set_pending.into()
set_pending
>
{move || match stories.get() {
None => None,
Expand Down
2 changes: 1 addition & 1 deletion examples/hackernews_islands_axum/src/routes/stories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub fn Stories() -> impl IntoView {
<div>
<Transition
fallback=|| ()
set_pending=set_pending.into()
set_pending
>
{move || stories.get().map(|story| story.map(|stories| view! {
<ul>
Expand Down
4 changes: 2 additions & 2 deletions leptos/src/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use std::{
/// <div>
/// <Transition
/// fallback=move || view! { <p>"Loading..."</p>}
/// set_pending=set_pending.into()
/// set_pending
/// >
/// {move || {
/// cats.read().map(|data| match data {
Expand Down Expand Up @@ -72,7 +72,7 @@ pub fn Transition<F, E>(
/// A function that will be called when the component transitions into or out of
/// the `pending` state, with its argument indicating whether it is pending (`true`)
/// or not pending (`false`).
#[prop(optional)]
#[prop(optional, into)]
set_pending: Option<SignalSetter<bool>>,
/// Will be displayed once all resources have resolved.
children: Box<dyn Fn() -> Fragment>,
Expand Down

0 comments on commit 1bd47f3

Please sign in to comment.