title: Why is onChanged being called when I navigate back to a fragment?
body: <p>I have a ViewModel handling my business logic and I am using Koin to inject this into my activity and each of my fragments. However after I navigate from Fragment A - Fragment B and navigate back to Fragment A, my observer is triggered again. Why is this happening and how do I stop this onChanged being triggered when I navigate back?</p>
  
  <p>I have tried setting both 'this' and 'viewLifecycleOwner' as the LifecycleOwner of the LiveData.</p>
  
  <p>I have also tried moving the observable to onCreate, onActivityCreated and onViewCreated</p>
  
  <p>My ViewModel:</p>
  
  <pre><code>class MyViewModel : ViewModel() {
  
      private val _myData = MutableLiveData&lt;Data&gt;()
      val myData = LiveData&lt;Data&gt;()
          get() = _myData
  
      fun doSomething() {
          ... // some code
          _myData.postValue(myResult)
  }
  </code></pre>
  
  <p>MyActivity:</p>
  
  <pre><code>class Activity : BaseActivity() {
  
      private val viewModel by viewModel&lt;MyViewModel&gt;()
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_login)
          setSupportActionBar(main_toolbar)
  
          subscribeUI()
      }
  
      private fun subscribeUI() {
          myViewModel.isLoading.observe(this, Observer {
              toggleProgress(it)
          })
      }
  }
  </code></pre>
  
  <p>Fragment A:</p>
  
  <pre><code>class FragmentA : BaseFragment() {
  
      private val viewModel by sharedViewModel&lt;MyViewModel&gt;()
  
      override fun onActivityCreated(savedInstanceState: Bundle?) {
          super.onActivityCreated(savedInstanceState)
          subscribeUI()
      }
  
      private fun subscribeUI() {
          viewModel.myData.observe(viewLifecycleOwner, Observer {
              val direction =
                  FragmentADirections.actionAtoB()
              mainNavController?.navigate(direction)
          })
      }
  }
  </code></pre>
  
  <p>Fragment B:</p>
  
  <pre><code>class FragmentB : BaseFragment() {
  
      private val authViewModel by sharedViewModel&lt;LoginViewModel&gt;()
  
      override fun onActivityCreated(savedInstanceState: Bundle?) {
          super.onActivityCreated(savedInstanceState)
          subscribeUI()
      }
  
      private fun subscribeUI() {
          viewModel.otherData.observe(viewLifecycleOwner, Observer {
              // Do something else...
          })
      }
  }
  </code></pre>
  
  <p>When I navigate from Fragment A -> Fragment B, everything works as I expect. However when I navigate back to Fragment A from Fragment B (by pressing the back button) the onChanged method from the Observer on myData is called and the navigation moves back to Navigation B.</p>