Skip to content

Support Compose 1.11 and deterministic subcomposition ordering - #194

Closed
zirman wants to merge 0 commit into
block:mainfrom
zirman:main
Closed

Support Compose 1.11 and deterministic subcomposition ordering#194
zirman wants to merge 0 commit into
block:mainfrom
zirman:main

Conversation

@zirman

@zirman zirman commented May 16, 2026

Copy link
Copy Markdown
Contributor
  • Upgrade Compose dependency to 1.11.1.
  • Update reflection logic in CompositionContexts.kt to support GapComposer, LinkComposer, and the RememberObserverHolder wrapper introduced in newer Compose versions.
  • Implement deterministic sorting of subcompositions by child placement order using reflection to access LayoutNode.getChildren.
  • Update instrumented tests to use v2 Compose test rules.
  • Update expected test output to reflect internal Compose naming changes, such as ProvideCompositionLocals.

@zirman
zirman requested a review from pyricau as a code owner May 16, 2026 18:27

@zach-klippenstein zach-klippenstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this! Please write tests for subcomposition ordering, if at all possible.

Comment on lines +38 to +46
data class LayoutNodeInfo(
val name: String,
val callChain: List<CallGroupInfo>,
val bounds: IntRect,
val modifiers: List<Modifier>,
val children: Sequence<ComposeLayoutInfo>,
val semanticsNodes: List<SemanticsNode>,
val name: String,
val callChain: List<CallGroupInfo>,
val bounds: IntRect,
val modifiers: List<Modifier>,
val children: Sequence<ComposeLayoutInfo>,
val semanticsNodes: List<SemanticsNode>,
// Node reference used to sort Subcompose Layouts deterministically across runs
val layoutNode: Any? = null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
data class LayoutNodeInfo(
val name: String,
val callChain: List<CallGroupInfo>,
val bounds: IntRect,
val modifiers: List<Modifier>,
val children: Sequence<ComposeLayoutInfo>,
val semanticsNodes: List<SemanticsNode>,
val name: String,
val callChain: List<CallGroupInfo>,
val bounds: IntRect,
val modifiers: List<Modifier>,
val children: Sequence<ComposeLayoutInfo>,
val semanticsNodes: List<SemanticsNode>,
// Node reference used to sort Subcompose Layouts deterministically across runs
val layoutNode: Any? = null,
/**
* @param layoutNode Node reference used to sort Subcompose Layouts deterministically across runs.
*/
data class LayoutNodeInfo(
val name: String,
val callChain: List<CallGroupInfo>,
val bounds: IntRect,
val modifiers: List<Modifier>,
val children: Sequence<ComposeLayoutInfo>,
val semanticsNodes: List<SemanticsNode>,
val layoutNode: Any? = null,

@zirman

zirman commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for this! Please write tests for subcomposition ordering, if at all possible.

I added a test but it's doesn't prove determinism. We have a large proprietary code base that we snapshot which is my real world test. So far these changes have generated the same order over multiple runs on different environments. I'm going to open a new PR since I broke this one from a force push when trying to sign commits. Thanks.

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