-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hilt viewmodel + replace + transition = crash #17
Comments
After looking more into this, this is a more general issue about auto dispose and transitions. So this probably becomes more a feature request as all the auto dispose / disposal stuff is internal it's not really possible to do it manually at the end of the transition. Tl;DR is: Auto dispose dispose things too early when using transitions. (And not using auto dispose is not really an option for large apps) Leading to a few side effects like :
|
Fixed just putting a missed remember on ViewModel creation here #18. Checkout solution |
Fixed on 1.0.0-beta13, feel free to reopen if the issue persists. |
So this is a tricky one.
Will lead to a crash
From a quick look the viewmodel is properly cleared, but it seems Voyager tries to re access the SaveStateProvider later with the same key (obviously as it's the same composable).
There's no issue without enabling transitions, so this looks like some wrong order of calls, whatever access the savestate during the transition should do it before the full removal of the composable to avoid trying to reuse the key.
There's also no problem when just pushing a new screen. This works without using hitviewmodel.
The text was updated successfully, but these errors were encountered: