Skip to content
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

Crash on koinNavGraphViewModel after 3.2.2 update #1446

Closed
LipeDuoli opened this issue Oct 4, 2022 · 1 comment
Closed

Crash on koinNavGraphViewModel after 3.2.2 update #1446

LipeDuoli opened this issue Oct 4, 2022 · 1 comment
Assignees
Labels
regression 💥 status:checking currently in analysis - discussion or need more detailed specs
Milestone

Comments

@LipeDuoli
Copy link

Describe the bug
I tried to update my project from version 3.2.0 to 3.2.2.
After migrate to the new android scope from the previous lazy delegate to the new createFragmentScope() All my calls to by koinNavGraphViewModel is crashing with the error

Trying to access Android Scope on 'HomeFragment{c1f0992} (aeee074c-3115-41a1-b87f-84b9bfb93494)' but scope is not created

my code is

private val viewModel: HomeViewModel by koinNavGraphViewModel(R.id.navGraph)

And if I change to

private val viewModel: HomeViewModel by viewModel()

the code do not crash anymore

Other places that I use just by viewModel(), continue to work fine

To Reproduce
Steps to reproduce the behavior:

  1. Create an fragment with the new android scope implementation (createFragmentScope())
  2. Inject an viewModel using by koinNavGraphViewModel

Expected behavior
scope to be inicialized when koinNavGraphViewModel is used

Koin project used and used version (please complete the following information):
Before:
koin-android:3.2.0
koin-androidx-workmanager:3.2.0
koin-androidx-navigation:3.2.0
koin-android-compat:3.2.0

After:
koin-android:3.2.2
koin-androidx-workmanager:3.2.2
koin-androidx-navigation:3.2.2
koin-android-compat:3.2.2

@arnaudgiuliani arnaudgiuliani added this to the 3.2.3 milestone Oct 11, 2022
@arnaudgiuliani arnaudgiuliani self-assigned this Oct 11, 2022
@arnaudgiuliani arnaudgiuliani added the status:checking currently in analysis - discussion or need more detailed specs label Oct 11, 2022
M-Olos-MOL added a commit to M-Olos-MOL/koin that referenced this issue Oct 18, 2022
M-Olos-MOL added a commit to M-Olos-MOL/koin that referenced this issue Oct 18, 2022
arnaudgiuliani added a commit that referenced this issue Oct 18, 2022
@arnaudgiuliani
Copy link
Member

Scope resolution has been fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression 💥 status:checking currently in analysis - discussion or need more detailed specs
Projects
None yet
Development

No branches or pull requests

2 participants