@ -8,7 +8,7 @@ import androidx.annotation.VisibleForTesting
import androidx.datastore.core.DataStore
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow. collec t
import kotlinx.coroutines.flow. firs t
import kotlinx.coroutines.launch
import mozilla.components.lib.state.Action
import mozilla.components.lib.state.Middleware
@ -155,18 +155,17 @@ internal fun restoreSelectedCategories(
selectedPocketCategoriesDataStore : DataStore < SelectedPocketStoriesCategories >
) {
coroutineScope . launch {
s electedPocketCategoriesDataStore. data . collect { persistedSelectedCategories ->
store . dispatch (
AppAction . PocketStoriesCategoriesSelectionsChange (
currentCategories ,
persistedSelectedCategories . valuesList . map {
s tore. dispatch (
AppAction . PocketStoriesCategoriesSelectionsChange (
currentCategories ,
selectedPocketCategoriesDataStore . data . first ( )
. valuesList . map {
PocketRecommendedStoriesSelectedCategory (
name = it . name ,
selectionTimestamp = it . selectionTimestamp
)
}
)
)
}
)
}
}