bounce-rs / bounce

The uncomplicated Yew State management library
https://bounce-rs.org
Apache License 2.0
101 stars 11 forks source link

SSR Support for Core API #56

Open futursolo opened 1 year ago

futursolo commented 1 year ago

13 delivers SSR Support for Helmet API and Query API whilst this issue aims to provide SSR support for the Core API.

This is not included in #13 as SSR is mostly useful with public facing pages which are indexed by SEO. States in those pages are usually obtainable from client-sided states.

futursolo commented 1 year ago

An atom / slice should be able to be marked as #[bounce(transitive)], this allows their values to be set with states initialiser / server-side default and send to the client side automatically via use_transitive_state.

For a state to be transitive, it needs to be #[derive(Serialize, Deserialize)]. Mutating states in SSR should not be supported as this should only happen with effects and effects do not run in SSR.