tqwewe / leptos_server_signal

Leptos server signals synced through websockets
MIT License
60 stars 12 forks source link

Bump leptos to 0.4.0 #5

Closed savoiringfaire closed 1 year ago

savoiringfaire commented 1 year ago

closes #4

Works fine locally when patching dependency, though I haven't heavily tested (have got a full websocket connection going and whatnot though)

savoiringfaire commented 1 year ago

Actually, thought I'd upgrade examples but getting an error when doing so for both examples:

error[E0618]: expected function, found `ReadSignal<serde_json::Value>`
   --> /home/marcus/src/plex-stuff/leptos_server_signal/src/lib.rs:141:76
    |
127 |             let (json_get, json_set) = create_signal(cx, serde_json::to_value(T::default()).unwrap());
    |                  -------- `json_get` has type `ReadSignal<serde_json::Value>`
...
141 |                                     let new_value = serde_json::from_value(json_get()).unwrap();
    |                                                                            ^^^^^^^^--
    |                                                                            |
    |                                                                            call expression requires function

error[E0618]: expected function, found `WriteSignal<T>`
   --> /home/marcus/src/plex-stuff/leptos_server_signal/src/lib.rs:142:37
    |
118 |     let (get, set) = create_signal(cx, T::default());
    |               --- `set` has type `WriteSignal<T>`
...
142 |                                     set(new_value);
    |                                     ^^^-----------
    |                                     |
    |                                     call expression requires function

For more information about this error, try `rustc --explain E0618`.
error: could not compile `leptos_server_signal` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Error: Failed to build actix_example

Don't have time to investigate tonight, happy for you to fix and merge this in the meantime, otherwise hopefully will be able to look tomorrow :smiley:

savoiringfaire commented 1 year ago

Ok, think I've got it. A few things to call out. The examples are now updated to use the new Leptos integration with the Axum state (second breaking change under https://github.com/leptos-rs/leptos/releases/tag/v0.4.0)

You also now need to opt into nightly to get things like the not needing .get() and .set() on signal structs so I've added a note to the readme explaining that. "Switch from defaulting to nightly and opting into stable, to requiring an opt-in for nightly features" from leptos 0.4.0 release notes.

tqwewe commented 1 year ago

Thanks a tonne for this! I've pushed a few small changes and it works great now :)