airbnb / mavericks

Mavericks: Android on Autopilot
https://airbnb.io/mavericks/
Apache License 2.0
5.83k stars 500 forks source link

todomvrx - todo edit - state on rotation no perserved #203

Closed OndrejMalek closed 5 years ago

OndrejMalek commented 5 years ago

Hi, just looking into your examples and EditText does not preserve state when changed than rotated. Is it intended behavior?

mradzinski commented 5 years ago

I guess it's the expected behavior. The text you input on the EditText isn't part of the VM state, nor its being handled in any way other than to create/edit tasks, so there's no reason for it to persist during such scenario.

You could make the user's input part of the state and have the EditText text set to this value during invalidate though.

OndrejMalek commented 5 years ago

Well thx, this does not seem like expected behavior from user perspective. To lose data on rotation. I does not make it easier to comprehend MvRx if it is part of framework or bug.

mradzinski commented 5 years ago

@OndrejMalek it's just a sample, not a full featured app. As such, it's intended to get you started with MvRx and not handling user input on configuration changes isn't a bug but and omittion most likely for brevity.

Anyway, you would handle user inputs almost exactly the same way as you handle other things.

elihart commented 5 years ago

Fixed with https://github.com/airbnb/MvRx/pull/209