intendednull / yewdux

Ergonomic state management for Yew applications
https://intendednull.github.io/yewdux/
Apache License 2.0
322 stars 31 forks source link

Docs/examples - restoring from persistent state #11

Closed Firstyear closed 2 years ago

Firstyear commented 3 years ago

It's not clear how when using a persistent store how these values are restored at app reload - generally most examples seem to apply a default value such as https://github.com/intendednull/yewdux/blob/master/examples/store/src/main.rs#L35 but if you had a persistent store, is there a way to say "okay, load this value OR use this default?"

intendednull commented 3 years ago

A persistent store checks for previously saved state on startup, using default if none is found. Right now the only way to customize this is by manually implementing Default, or using a custom Store.

Firstyear commented 3 years ago

Hmmm this really wasn't clear from any of the documentation or examples though. would it be possible to extend that in the persistent store docs and/or the examples?

intendednull commented 3 years ago

Yes absolutely! Docs are in dire need of improvement, definitely a focus for next release.

Firstyear commented 3 years ago

Well, feel free to ping me to perform docs review / examples review if you would like :)

intendednull commented 2 years ago

New implementation is much simpler, with more control given to user. Examples and docs are done as well, think it's safe to close this.

Firstyear commented 2 years ago

Thank you @intendednull! I'll have to give the latest update a go :) Appreciate your time and work!