We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am getting a lifetime error when using multiple layers of nested signals and Indexed
This code produces the error:
#[component] pub fn TempComponent<G: Html>(ctx: Scope) -> View<G> { let original = create_signal(ctx, vec![create_signal(ctx, vec![create_signal(ctx, 1)])]); view!{ctx, Indexed { iterable: original, view: |ctx, var| view! {ctx, InnerComponent(var) } } } } #[component] fn InnerComponent<'a, G: Html>(ctx: Scope<'a>, var: &'a Signal<Vec<&'a Signal<i32>>>) -> View<G> { view!{ctx, } }
This code works fine:
#[component] pub fn TempComponent<G: Html>(ctx: Scope) -> View<G> { let original = create_signal(ctx, vec![create_signal(ctx, 1)]); view!{ctx, Indexed { iterable: original, view: |ctx, var| view! {ctx, InnerComponent(var) } } } } #[component] fn InnerComponent<'a, G: Html>(ctx: Scope<'a>, var: &'a Signal<i32>) -> View<G> { view!{ctx, } }
The text was updated successfully, but these errors were encountered:
Hmm this seems to be some kind of issue with Rust's lifetime shortening algorithm. This works:
#[component] pub fn TempComponent<G: Html>(cx: Scope) -> View<G> { let original = create_signal(cx, vec![create_signal(cx, vec![create_signal(cx, 1)])]); view! { cx, Indexed { iterable: original, view: |cx, var| view! { cx, InnerComponent(var) } } } } #[component] fn InnerComponent<'a, 'b: 'a, G: Html>( cx: Scope<'a>, _var: &'b Signal<Vec<&'b Signal<i32>>>, ) -> View<G> { view! {cx, } }
Sorry, something went wrong.
I'll leave this open for now because it's kind of weird that the first doesn't work but the second works.
create_ref
T: 'static
Successfully merging a pull request may close this issue.
I am getting a lifetime error when using multiple layers of nested signals and Indexed
This code produces the error:
This code works fine:
The text was updated successfully, but these errors were encountered: