-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
ViewModel is cleared too early #106
Comments
I‘ve encounter a related issue without having to click fast: when using a transition animation when popping screen 2 the viewmodel gets cleaned up to early. The transition will call I used the latest version rc3 |
We have encountered a similar issue, also without clicking fast. ViewModels will be cleared before the animations are done, which will result in a ViewModel leak, as follows:
This leads to some weird bugs in our application and should probably be fixed quickly. I might be able to create a PR once I have found a solution. |
Our current workaround is to disable calling the content function on animations if the lifecycle is already destroyed:
The downside of that is having no content when navigating from one screen to another. But at least, the app behaves as expected. |
Thanks. Having no contend on animations is not a solution for us unfortunately. I will try to find another workaround, maybe by disposing the screen manually after the animation completes and disabling Voyagers disposal. |
So after some research I have found a working workaround for the issue that also renders the screen during the animations. There is a couple of issues at play here:
This fixes the first issue.
My current workaround for this is to disable the default dispose behavior of Voyager entirely and disposing by hand after the transition is completed. Unfortunately for this I have to copy the private I will probably post a complete workaround once I have fleshed it out. |
Do you already have some code to share for the "waiting for animation to complete" problem? Thx. |
Yes, you can do the following:
Here you have to call the
The animation listener code might be improved, its a bit rudimentary but it works (see the slack thread in the comments). Hope this helps you out! Please note that the |
Hey folks, I have built a solution for this directly in the ScreenTransition, if any one wants to try out and give feedbacks #436 |
We have release this API at |
I encountered an issue with navigation in my app. Let's say I have
Feature1
andFeature2
screens and both usegetViewModel()
insideContent
function.I navigate
Feature2
-> [pop] back toFeature1
-> [push] open againFeature2
pretty fast.What's happening in my logs: when I pop
Feature2
screen, VM gets cleared in about 30ms, but screen is disposed in 600-700ms, so if then I pushFeature2
again within these 600-700ms, I'm stuck onFeature2
screen with cleared VM.The text was updated successfully, but these errors were encountered: