title: How to dynamically modify variables in PagingSource class, Paging Library 3.0
body: <p>I have a livedata called <strong>selectedModuleTab</strong> which holds some variables like <strong>filters</strong>
  I need to pass those filters to the data source repository <strong>crmRepo</strong> in order to fetch data from server.</p>
  <p>I just started to use Paging Library 3.0 and i can't figure it out how to modify the <strong>PagingSource class</strong> every time my filters change.</p>
  <p>I've tried to use Transformations but then i needed to create the <strong>Pager</strong> every time the filters change, this causes scroll position to be lost after returning to this view.</p>
  <p>How can i modify the PageSource class every time a <strong>livedata changed</strong> (selectedModuleTab) ?</p>
  <p>In my ViewModel I have this LiveData:</p>
  <pre><code>    val recordsList = Pager(PagingConfig(pageSize = 10),
      pagingSourceFactory = { RecordListPagingSource(crmRepo, selectedModuleTab.value) })
      .liveData
      .cachedIn(viewModelScope)
  </code></pre>
  <p>And this is my PageSource class:</p>
  <pre><code>    class RecordListPagingSource(private val crmRepo: CrmRepository, private val moduleTab: ModuleTab?) :
      PagingSource&lt;Int, SmallRecordModel&gt;() {
      override suspend fun load(params: LoadParams&lt;Int&gt;): LoadResult&lt;Int, SmallRecordModel&gt; {
          return try {
              val page = params.key ?: 0
              LoadResult.Page(
                  data = crmRepo.getRecordsListFromModuleSuspended(
                      ACCOUNT_MODULE,
                      (page * 10),
                      moduleTab?.tabFilters,
                      moduleTab?.tabLayout
                  ),
                  prevKey = page - 1,
                  nextKey = page + 1
              )
          } catch (e: Exception) {
              LoadResult.Error(e)
          }
      }
  }
  </code></pre>