title: RecyclerView remains empty with Paging Library and PositionalDataSource
body: <p>I am trying to configure the Android Paging library in my project to load a paginated list of messages into a RecyclerView. Since my API uses offset and max, I'm using a PositionalDataSource.</p>
  
  <p>Here is my DataSource implementation, where DataStore is using RetroFit to load the messages, and I can see in the console that messages are being loaded properly, and converted to instances of MessageListItem:</p>
  
  <pre><code>class MessageDataSource: PositionalDataSource&lt;MessageListItem&gt;() {
      override fun loadRange(params: LoadRangeParams, callback: LoadRangeCallback&lt;MessageListItem&gt;) {
          DataStore.shared.loadMessages(params.startPosition, params.loadSize) { result, error -&gt;
              if(result != null) {
                  callback.onResult(result.items)
              } else {
                  callback.onError(MessageDataSourceException(error))
              }
          }
      }
  
      override fun loadInitial(
          params: LoadInitialParams,
          callback: LoadInitialCallback&lt;MessageListItem&gt;
      ) {
          DataStore.shared.loadMessages(params.requestedStartPosition, params.requestedLoadSize) { response, error -&gt;
              if(response != null) {
                  callback.onResult(response.items, response.offset, response.total)
              } else {
                  callback.onError(MessageDataSourceException(error))
              }
          }
      }
  }
  
  class MessageDataSourceException(rootCause: Throwable? = null): Exception(rootCause)
  </code></pre>
  
  <p>Here is my DataSourceFactory implementation:</p>
  
  <pre><code>class MessageDataSourceFactory: DataSource.Factory&lt;Int, MessageListItem&gt;() {
      val messageLiveDataSource = MutableLiveData&lt;MessageDataSource&gt;()
      private lateinit var messageDataSource: MessageDataSource
  
      override fun create(): DataSource&lt;Int, MessageListItem&gt; {
          messageDataSource = MessageDataSource()
          messageLiveDataSource.postValue(messageDataSource)
          return messageDataSource
      }
  }
  </code></pre>
  
  <p>Here is my MessageListAdapter implementation:</p>
  
  <pre><code>object MessageListItemDiff: DiffUtil.ItemCallback&lt;MessageListItem&gt;() {
      override fun areItemsTheSame(oldItem: MessageListItem, newItem: MessageListItem): Boolean {
          return oldItem.id == newItem.id
      }
  
      override fun areContentsTheSame(oldItem: MessageListItem, newItem: MessageListItem): Boolean {
          return oldItem == newItem
      }
  }
  
  class MessageListAdapter(private val clickListener: View.OnClickListener):
      PagedListAdapter&lt;MessageListItem, MessageListAdapter.MessageHolder&gt;(MessageListItemDiff) {
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MessageHolder {
          val inflatedView = LayoutInflater.from(parent.context).inflate(R.layout.item_message, parent, false)
          return MessageHolder(inflatedView, clickListener)
      }
  
      override fun onBindViewHolder(holder: MessageHolder, position: Int) {
          holder.bind(getItem(position)!!)
      }
  
      class MessageHolder(itemView: View, private val clickListener: View.OnClickListener) : RecyclerView.ViewHolder(itemView) {
          val unreadIndicator = itemView.findViewById&lt;ImageView&gt;(R.id.unreadIndicator)
          val title = itemView.findViewById&lt;TextView&gt;(R.id.title)
          val dateSent = itemView.findViewById&lt;TextView&gt;(R.id.dateSent)
          val cardView = itemView.findViewById&lt;CardView&gt;(R.id.card_view)
  
          fun bind(message: MessageListItem) {
              cardView.tag = message
              cardView.setOnClickListener(clickListener)
              title.text = message.title
              dateSent.text = TimeAgo.using(message.dateSent.time)
              if(message.isRead) {
                  unreadIndicator.setImageResource(0)
              } else {
                  unreadIndicator.setImageResource(R.drawable.ic_unread)
              }
          }
      }
  }
  </code></pre>
  
  <p>And finally my ViewModel:</p>
  
  <pre><code>class MessageListViewModel: ViewModel() {
      val messagePagedList: LiveData&lt;PagedList&lt;MessageListItem&gt;&gt;
      val liveDataSource: LiveData&lt;MessageDataSource&gt;
  
      init {
          val messageDataSourceFactory = MessageDataSourceFactory()
          liveDataSource = messageDataSourceFactory.messageLiveDataSource
  
          val pagedListConfig = PagedList.Config.Builder()
              .setEnablePlaceholders(false)
              .setPageSize(30)
              .setPrefetchDistance(90)
              .build()
          messagePagedList = LivePagedListBuilder(messageDataSourceFactory, pagedListConfig).build()
      }
  }
  </code></pre>
  
  <p>And here is the onViewCreated implementation in the fragment that is supposed to display the recycler view called messageList:</p>
  
  <pre><code>override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  
          messageList.layoutManager = LinearLayoutManager(context!!)
          messageList.setHasFixedSize(true)
  
          messageListViewModel = ViewModelProvider(this).get(MessageListViewModel::class.java)
          messageListAdapter = MessageListAdapter(this)
  
          messageListViewModel.messagePagedList.observe(this, Observer { messages -&gt;
              messageListAdapter.submitList(messages)
          })
  
          messageList.adapter = messageListAdapter
      }
  </code></pre>
  
  <p>The problem is that I can see that data is being loaded from the server, but it never reaches the recycler view. If I add a breakpoint on the observer line (<code>messageListAdapter.submitList(messages)</code>), I get a call once with an empty message list, and that's it.</p>
  
  <p>I have to admit I'm really confused with all these classes and what they are supposed to do, this is my first Paging implementation in Android, and I had to adapt code I found here and there because I didn't want to use a Room database, RxJava or a PageKeyedDataSource, which most samples out there do.</p>
  
  <p>Any idea what might be going on?</p>