The android team has created a mess with regard to live data observed from a DialogFragment.
I've heard BOTH that you should observe live data with this instead of viewLifecycleOwner AND the opposite. This "explanation" from Google only adds to the confusion:
Note: When subscribing to lifecycle-aware components such as LiveData, you should never use viewLifecycleOwner as the LifecycleOwner in a DialogFragment that uses Dialogs. Instead, use the DialogFragment itself, or if you're using Jetpack Navigation, use the NavBackStackEntry.
What does it even mean "a DialogFragment that uses Dialogs"? Doesn't EVERY DialogFragment "use" a Dialog? Or does a DialogFragment only "use" a Dialog when you override onCreateDialog???
What I infer from this confusing explanation is that you should use this instead of viewLifecycleOwner if and only if you customize the dialog by overriding onCreateDialog, but it's totally unclear.
And I'm not even clear whether you should observe from onCreateView or onViewCreated. Which is it?
For the love of all that is holy, can I get a final consistent answer on how to properly observe live data in a DialogFragment? Specifically, in my project I ALWAYS inflate a custom layout for my dialogs in onCreateView and I NEVER override onCreateDialog.