-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Compose Only Based Navigation: View Model Leaks Not Auto Detected? #2678
Comments
So what are you doing exactly to trigger the leak? Configuration change? |
Keeping a reference around for our view model when |
I haven't tested view model leak detection on compose projects. View model leak detection is kicked off by
I suspect that the issue here is one of:
I wrote all this before Compose was a thing, so it's very possible we have a bug. Let me know what you find. Don't hesitate to put breakpoints in |
Thank you for this info! This allows me to investigate further.. |
Cool. Did you find anything? |
We have an app with Leak Canary integrated within our instrumentation tests. Works great for activity leaks, as we manually created a leak and it fails the test. Auto detection of activities working.
However, we manually created a leaking view model (a strong global reference is held on to the view model within its init) and the test continues to pass. Auto detection of view models not working.
LocalViewModelStoreOwner.current
provided byNavBackStackEntry.LocalOwnersProvider
here.Is there additional setup that is needed to detect view models created from Compose when using Compose Navigation instead of Activity/Fragment navigation? The docs say no.
Is there documentation on how this auto view model detection works?
The text was updated successfully, but these errors were encountered: