Skip to content

Add keyed defaultComponentContext for parallel Android roots#991

Closed
Codex wants to merge 2 commits into
masterfrom
codex/add-key-parameter-to-default-component-context
Closed

Add keyed defaultComponentContext for parallel Android roots#991
Codex wants to merge 2 commits into
masterfrom
codex/add-key-parameter-to-default-component-context

Conversation

@Codex

@Codex Codex AI commented Mar 23, 2026

Copy link
Copy Markdown

defaultComponentContext lacked a way to scope state/retained instances when creating multiple contexts in the same Activity/Fragment.

  • API: Added optional key to Activity/Fragment defaultComponentContext overloads; API surface updated.
  • Behavior: Keyed state keepers and per-key InstanceKeeperDispatcher to avoid collisions; preserves old behavior when key is null.
  • Docs: Clarified single-call guidance now except when using unique keys.
  • Tests: Added Android unit tests covering per-key state/instance isolation and discard semantics.

Example:

// Two independent contexts on the same host
val primary = defaultComponentContext(key = "primary")
val secondary = defaultComponentContext(key = "secondary", discardSavedState = true)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/arkivanov/Essenty/contents
    • Triggering command: /usr/bin/curl curl -s REDACTED git |\\#�� --show-toplevel (http block)
  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.11.1-all/2qik7nd48slq1ooc2496ixf4i/gradle-8.11.1/lib/gradle-daemon-main-8.11.1.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add key parameter to defaultComponentContext function</issue_title>
<issue_description>Similarly to retainedComponentContext.</issue_description>

Comments on the Issue (you are @codex[agent] in this section)

@Codex Codex AI changed the title [WIP] Add key parameter to defaultComponentContext function Add keyed defaultComponentContext for parallel Android roots Mar 23, 2026
@Codex Codex AI requested a review from arkivanov March 23, 2026 04:17
*/
fun <T> T.defaultComponentContext(
discardSavedState: Boolean = false,
key: String? = null,

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.

This breaks the binary compatibility. We'd need a new overload.

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.

Add key parameter to defaultComponentContext function

2 participants