Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
jb...@google.com <jb...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
Description
When calling the
by viewModels
lazy function from a fragment, if you passed in the owner and did not specify the factory i.e:the resulting viewModel would be created using the fragment's ViewModel factory instead of the owner's, which in this case is the activity's factory.
We should make sure that the
viewModels
function first uses the factory passed in, followed by the owner's, and if those are both null, only then does it fall back to the fragment's.