square / workflow-kotlin

A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.
https://square.github.io/workflow
Apache License 2.0
1.02k stars 101 forks source link

Make WorkflowSavedStateRegistryAggregator.attachToParentRegistryOwner more convenient. #681

Open rjrjr opened 2 years ago

rjrjr commented 2 years ago

There are three copies of this fragment floating around:

    val parentRegistryOwner = stateRegistryOwnerFromViewTreeOrContext(this)
    val key = Compatible.keyFor(this.getRendering()!!)
    viewStateCache.attachToParentRegistryOwner(key, parentRegistryOwner)

Add an overload of WorkflowSavedStateRegistryAggregator.attachToParentRegistryOwner that takes a View and enshrines the convention.

Hide the existing method or leave it public? I have a hunch we may find ourselves calling it from Compose some day, if we start using its dialog() function.

rjrjr commented 3 months ago

Doubt we'll bother with this, and if we do introducing an overload is not a breaking change. Dropping from the ui-1.0 milestone.