Adrian Witaszak
02/13/2023, 11:08 PMCasey Brooks
02/13/2023, 11:20 PMloading
flag which defaults to false
, and then flips to true
after state restoration. Part of the MVI model is its async nature, so it’s not always possible to ensure things get processed fast enough to avoid things like this. The savedState restoration function was designed to allow for suspending save/restore, so keep that in mind.
If your state restoration is truly synchronous, then setting those values in the initialState
in the ViewModel configuration might be a better place to do it, which does ensure the first value emitted from the VM state has the values you expect. You’ll want to combine this with your own interceptor to save the state, though.