Skip to content

fix!: Ensure data stores persist across configuration changes#269

Merged
jonnyandrew merged 3 commits into
mainfrom
jonny/DCMAW-12575
Apr 8, 2025
Merged

fix!: Ensure data stores persist across configuration changes#269
jonnyandrew merged 3 commits into
mainfrom
jonny/DCMAW-12575

Conversation

@jonnyandrew
Copy link
Copy Markdown
Contributor

Changes

  • Lift in-memory stores out of the composition scope into a new singleton Dagger component.

New public API

Before, you could initialise CRI Orchestrator SDK within the composition like so:

@Composable
fun MyComposable() {
    val criOrchestratorComponent = rememberCriOrchestrator(
        authenticatedHttpClient = httpClient,
        analyticsLogger = analyticsLogger,
        initialConfig = config,
        logger = logger,
    )
}

Now you should initialise the CRI Orchestrator SDK as a singleton in your app using:

// Create one instance of this object
val criOrchestratorSdk = CriOrchestratorSdk.create(
    ...
)

And use this later in your composition:

@Composable
fun MyComposable() {
    val criOrchestratorComponent = rememberCriOrchestrator(
        criOrchestratorSdk = criOrchestratorSdk
    )
}

Context

DCMAW-12575

This change allows some state from the SDK to outlive the composition so that it survives configuration changes.

Evidence of the change

Checklist

  • Check against acceptance criteria
  • Add automated tests
  • Self-review code

@jonnyandrew jonnyandrew force-pushed the jonny/DCMAW-12575 branch 2 times, most recently from f031ec1 to ca8a4c4 Compare April 7, 2025 14:25
@jonnyandrew jonnyandrew changed the base branch from main to jonny/DCMAW-12575-config-toggle April 7, 2025 14:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2025

Analytics test report is available to download.

Base automatically changed from jonny/DCMAW-12575-config-toggle to main April 7, 2025 15:05
@jonnyandrew jonnyandrew force-pushed the jonny/DCMAW-12575 branch 2 times, most recently from 386078d to e1e97cf Compare April 8, 2025 10:56
@jonnyandrew jonnyandrew marked this pull request as ready for review April 8, 2025 14:53
@jonnyandrew jonnyandrew requested review from a team as code owners April 8, 2025 14:53
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2025

@jonnyandrew jonnyandrew merged commit f28aaa4 into main Apr 8, 2025
10 checks passed
@jonnyandrew jonnyandrew deleted the jonny/DCMAW-12575 branch April 8, 2025 15:49
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