leptos-use icon indicating copy to clipboard operation
leptos-use copied to clipboard

sync_signal allow a store field

Open johansmitsnl opened this issue 8 months ago • 1 comments

sync_signal accepts rw and signals. But with reactive stores you can't sync a signal. Add support for this type to.

johansmitsnl avatar Apr 26 '25 20:04 johansmitsnl

Would you mind providing a minimal example that currently doesn't work, but should do so?

maccesch avatar Apr 28 '25 04:04 maccesch

Something like this:

#[derive(Debug, Store, Serialize, Deserialize)]
struct Todos {
    user: String,
}

let data = Todos {
  user: String::from("Bob")
};

let store = Store::new(data());
let rw = RwSignal::new(String::from("John"));

sync_signal(store.user(), rw);

johansmitsnl avatar Apr 30 '25 17:04 johansmitsnl