Skip to content

Commit

Permalink
Merge pull request #492 from arkivanov/avoid-using-configurations-as-…
Browse files Browse the repository at this point in the history
…keys-in-pages

Avoid using configurations as keys in Pages
  • Loading branch information
arkivanov authored Sep 27, 2023
2 parents d9c4500 + df52824 commit 78d15ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class PagesTest {
composeRule.runOnIdle {}
}

private sealed class Config : Serializable {
private sealed class Config {
data object Config1 : Config()
data object Config2 : Config()
data object Config3 : Config()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import com.arkivanov.decompose.ExperimentalDecomposeApi
import com.arkivanov.decompose.InternalDecomposeApi
import com.arkivanov.decompose.extensions.compose.jetpack.subscribeAsState
import com.arkivanov.decompose.hashString
import com.arkivanov.decompose.router.pages.ChildPages
import com.arkivanov.decompose.value.Value

Expand Down Expand Up @@ -46,6 +48,7 @@ fun <T : Any> Pages(
/**
* Displays a list of pages represented by [ChildPages].
*/
@OptIn(InternalDecomposeApi::class)
@ExperimentalFoundationApi
@ExperimentalDecomposeApi
@Composable
Expand Down Expand Up @@ -82,7 +85,7 @@ fun <T : Any> Pages(
pager(
modifier,
state,
{ childPages.items[it].configuration },
{ childPages.items[it].configuration.hashString() },
) { pageIndex ->
childPages.items[pageIndex].instance?.also { page ->
pageContent(pageIndex, page)
Expand Down

0 comments on commit 78d15ba

Please sign in to comment.