When the app is closed then the subscribeAsState() doesn't work #686
Replies: 12 comments 1 reply
-
It's hard to say what's the reason without the UI part of the code, or a reproducer. Would you be able to provide? You can also check the sample, I believe it works fine. |
Beta Was this translation helpful? Give feedback.
-
also with RootComponent
RootContent
|
Beta Was this translation helpful? Give feedback.
-
The code looks good, I don't see any issues currently. How do you create your Also, since you exposed |
Beta Was this translation helpful? Give feedback.
-
I use Koin for DI, so the RootComponent is created in CommonModule
and in the MainActivity I have:
|
Beta Was this translation helpful? Give feedback.
-
@arkivanov I noticed that the issue is when the stack is updated, after the app comes from background: when the |
Beta Was this translation helpful? Give feedback.
-
Thanks, I can't 100% confirm correctness, but looks fine. Please double check the following:
If the issue is still there, it would be nice to have a complete reproducer for this issue. |
Beta Was this translation helpful? Give feedback.
-
I have created a public repository
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the reproducer! Turned out your There are two options: |
Beta Was this translation helpful? Give feedback.
-
thanks @arkivanov I solved the issue on Android using retained components initializing RootComponent in the MainActivity. Can you please provide the documentation for iOS? How I should init RootComponent in iOS? |
Beta Was this translation helpful? Give feedback.
-
For iOS and other platforms you can check Quick Start docs. You can also check the sample iOS app. |
Beta Was this translation helpful? Give feedback.
-
Hello, yes I solved it also on iOS. Using Koin I had to change something but now it works as expected. I used the experimental ApplicationLifecycle which simplifies a lot of the logic. if you want I can share the base project to see how to include Decompose with Koin and have also a simple DomainComponent injected in the RootComponent. anyway, Thank you very much 🙂 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the update! Feel free to add your project to the Used By list. I will also convert this issue to a QnA discussion, so that it could be discovered later. |
Beta Was this translation helpful? Give feedback.
-
I have a simple app with tab bar navigation.
The navigation is done with
bringToFront
APIIt works properly, the state is updated and the active tab is highlighted correctly.
clicking back I use
pop()
to go back and then in the end the app is closed. Once I open it again the state is not updated correctly.When I click on another tab the tab is not highlighted anymore and the Child is not shown correctly.
What can be the issue?
Here a screen recording
Screen_recording_20240402_184647.mp4
Beta Was this translation helpful? Give feedback.
All reactions