Skip to content

ChildItems support#108

Merged
xxfast merged 6 commits into
xxfast:mainfrom
Skeptick:child-items-support
Jul 11, 2026
Merged

ChildItems support#108
xxfast merged 6 commits into
xxfast:mainfrom
Skeptick:child-items-support

Conversation

@Skeptick

@Skeptick Skeptick commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

No description provided.


@OptIn(ExperimentalDecomposeApi::class)
@Composable
fun <C : Any> ItemsRouterLifecycleController(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the naming. Open to suggestions.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we usually call this RoutedContent, maybe the same naming for this too?

@xxfast

xxfast commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Nice addition 🙌 Sorry i've been ignoring these PRs for a year, my bad

One thing to sort before this can merge:

In items/Router.kt, items resolves its state in a getter:

val items: State<ChildItems<C, RouterContext>>
  get() = lazyItems.asState(lifecycle)

asState allocates a fresh mutableStateOf and adds a new subscribe(lifecycle) on every call, so each read (e.g. by router.items in RoutedItems, re-run on recomposition) re-subscribes and hands back a new State. The existing flavors (pages/slot/stack) call asState once in the factory and store the result as a val. Can you match that here, resolve once and hold it, instead of in the getter?

Separately, this branched off an older main: it'll need a rebase onto current (decompose is on 3.5.0 now, so the libs.versions.toml bump conflicts) and an apiDump for the new public API. Happy to help with that part if useful.

Actually i think i have push access to this branch so let me do that

@xxfast xxfast self-requested a review July 11, 2026 01:19

@xxfast xxfast left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@xxfast xxfast merged commit bcd9c79 into xxfast:main Jul 11, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants