Hi guys,
I'm trying to recreate what's documented in https://dioxuslabs.com/learn/0.5/reference/dynamic_rendering#rendering-lists
on a list that used use_ref() in the past but that now uses a signal.
But the part that comes directly from the documentation gives me this error:
error[E0597]: `search_results` does not live long enough
--> front/src/page/create_bis.rs:58:24
|
34 | let mut search_results = use_signal(Vec::<ComputedResult>::new);
| ------------------ binding `search_results` declared here
...
58 | let results_lock = search_results.read();
| ^^^^^^^^^^^^^^-------
| |
| borrowed value does not live long enough
| argument requires that `search_results` is borrowed for `'static`
...
91 | }
| - `search_results` dropped here while still borrowed
error[E0597]: `results_lock` does not live long enough
--> front/src/page/create_bis.rs:59:28
|
58 | let results_lock = search_results.read();
| ------------ binding `results_lock` declared here
59 | let results_rendered = results_lock.iter().map(|r| {
| ^^^^^^^^^^^^ borrowed value does not live long enough
60 | / rsx! {
61 | | li {
62 | | onclick: move |_| {
63 | | match r {
... |
81 | | }
82 | | }
| |_________- argument requires that `results_lock` is borrowed for `'static`
...
91 | }
| - `results_lock` dropped here while still borrowed
What am I missing? I'm simply trying to avoid cloning the results that are in my signal. Thank you