Noticed that restoring the state in SavedStateAdap...
# ballast
Noticed that restoring the state in SavedStateAdapter is visibly slow. When the screen loads I can see text fields populating and tabs switching. Works fine when setting state values from preferences.
You could look at switching the interceptor dispatcher to see if that helps, but you might also consider setting a
flag which defaults to
, and then flips to
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
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.