Added SavedStateController across platforms to support default ViewModelProviderFactory#2554
Conversation
Introduced SavedStateRegistry integration to handle the state saving/restoration mechanism across platforms. This includes support for `SavedStateRegistryOwner` in Skiko, UIKit, and Desktop implementations.
…n Skiko and Desktop implementations
…ecycle.State` updates via `ViewControllerLifecycleDelegate` and `SavedStateRegistry` support in `UIKitArchitectureComponentsOwner`.
…ved state management across platforms. Replaced platform-specific implementations with `DefaultArchitectureComponentsOwner`.
…in Skiko implementation
…omponentsOwner` in lifecycle-related tests
Refactored `DefaultArchitectureComponentsOwner` methods to replace direct lifecycle event handling with `initSavedStateController` and `onLifecycleState` calls. Added state saving logic during scene closure.
…f `container.lifecycle`
…etLifecycleState` across platforms
… instead of ON_CREATE
…save state during closure
…ensure proper initialization sequence.
ASalavei
reviewed
Nov 7, 2025
.../ui/src/uikitMain/kotlin/androidx/compose/ui/window/ViewControllerLifecycleDelegate.uikit.kt
Outdated
Show resolved
Hide resolved
ASalavei
approved these changes
Nov 7, 2025
… and consistency across lifecycle state handling. Update references in tests and related files.
… in constructor. Remove redundant `initSavedStateController` calls across platforms. Update tests and related files for consistency.
…or consistency with lifecycle dependencies
MatkovIvan
reviewed
Nov 10, 2025
Member
MatkovIvan
left a comment
There was a problem hiding this comment.
LGTM in general, just a few minor nitpicks + a need for more tests
compose/ui/ui/src/webCommonW3C/kotlin/androidx/compose/ui/window/ComposeWindow.w3c.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/webCommonW3C/kotlin/androidx/compose/ui/window/ComposeWindow.w3c.kt
Outdated
Show resolved
Hide resolved
...e/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeHostingViewController.uikit.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/scene/ComposeContainer.desktop.kt
Show resolved
Hide resolved
compose/ui/ui-test/src/skikoMain/kotlin/androidx/compose/ui/test/ComposeUiTest.skiko.kt
Show resolved
Hide resolved
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/platform/CompositionLocals.skiko.kt
Show resolved
Hide resolved
MatkovIvan
approved these changes
Nov 10, 2025
MatkovIvan
reviewed
Nov 10, 2025
| GraphicsComponents, | ||
| Screen.Example("Example1") { Example1() }, | ||
| Screen.Example("ImageViewer") { ImageViewer() }, | ||
| Screen.Example("ViewModelExample") { ViewModelExample() }, |
Member
There was a problem hiding this comment.
Since the sample is inside NavHost I suspect that it works even without this fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement
HasDefaultViewModelProviderFactoryacross platforms.Fixes https://youtrack.jetbrains.com/issue/CMP-6641
Release Notes
Fixes - SavedState
HasDefaultViewModelProviderFactoryimplementation now, and it provides an ability to usecreateSavedStateHandle()function without a navigation library.