title: No adapter attached but already set on fragment
body: <p>i have encountered this so many times before but this time it's kinda frustrating. I already change the order of attachiing the adapter: setLayoutManager first; observe the viewmodel first; nothing worked. the viewmodel function is not being observed either. here's my code:</p>
  <pre><code>class FavoriteMoviesFragment : Fragment() {
  
  companion object {
      fun newInstance() = FavoriteMoviesFragment()
  }
  
  private val viewModel: FavoriteMoviesViewModel by viewModels()
  private var favmovieAdapter = MoviesAdapter(object : MovieClickListener {
      override fun onMovieClicked(movie: Movies?) {
          viewModel.onMovieClicked(movie)
      }
  })
  
  override fun onCreateView(
      inflater: LayoutInflater, container: ViewGroup?,
      savedInstanceState: Bundle?
  ): View? {
      val recyclerView = view?.findViewById&lt;RecyclerView&gt;(R.id.rvFavMovies)
      Log.d(&quot;favAdapter&quot;, &quot;Adapter attached $favmovieAdapter&quot;)
      recyclerView?.layoutManager = LinearLayoutManager(activity?.applicationContext)
      recyclerView?.setHasFixedSize(true)
      recyclerView?.adapter = favmovieAdapter
      vmSetup()
      return inflater.inflate(
          R.layout.favorite_movies_fragment,
          container, false
      )
  }
  
  fun vmSetup() {
      viewModel.getFavMovies().observe(viewLifecycleOwner, { movielist -&gt;
          if (movielist != null) {
              Log.d(&quot;pagedFavList&quot;, &quot;List size: ${movielist.size}&quot;)
              favmovieAdapter.submitList(movielist)
              favmovieAdapter.notifyDataSetChanged()
          } else {
              Toast.makeText(context, &quot;Data Loading Always Failed&quot;, Toast.LENGTH_SHORT).show()
          }
      })
      viewModel.navigatetoDetail().observe(viewLifecycleOwner, { movies -&gt;
          if (movies != null) {
              val action =
                  FavoriteFragmentDirections.actionFavoriteFragmentToDetailFragment(movies, null)
              Navigation.findNavController(requireView()).navigate(action)
              viewModel.onMovieDetailNavigated()
          }
      })
  }
  </code></pre>
  <p>any idea to solve this problem?</p>