Skip to content
Discussion options

You must be logged in to vote

Hello @Nikola-Milovic and thanks for your questions!

  1. Retained instances

As per documentation, InstanceKeeper retains things (not only Stores) over their scope recreation. This means that objects are not retained in memory forever, but only until its scope (e.g. a Decompose component, or a Fragment) is alive or is being recreated due to Android configuration changes. So it is very similar to AndroidX ViewModels.

As of Decompose, when you pop a component, its retained instances are destroyed (InstanceKeeper.Instance.onDestroy method is caled). If there is a stack of components and you rotate the screen, only the currently active component is recreated and its InstanceKeeper instances are …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Nikola-Milovic
Comment options

Answer selected by arkivanov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants