codinginflow / MVVMTodo

187 stars 124 forks source link

We never save the searchQuery data with SavedStateHandle #7

Closed lukaIvanic closed 3 years ago

lukaIvanic commented 3 years ago

No real issue here, it's just that we never actually save query data into state (SavedStateHandle). All I did was add:

init { searchQuery.map { state.set("searchQuery", it) } }

Or maybe I'm just dumb and missed something

codinginflow commented 3 years ago

We use getLiveData which automatically saves the value to SavedStateHandle whenever it changes.

lukaIvanic commented 3 years ago

Hmm weird, I only noticed the issue because I wouldn't get the query back on process death, but maybe I missed something. Either way it's fixed, thank you for the answer, and especially thanks for the awesome tuts!