You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Since Koin 4.0.x, when injecting an instance tagged as a @Factory using the inject function in a KoinComponent, the first parameter of same type is returned instead of being actually passed as a parameter of the requested factory instance (see resolveFromContext() inside the Scope class).
This behaviour started occurring when migrating from 3.x.x to 4.0.x.
To Reproduce
Define a class as a factory using the @Factory annotation
Somewhere inside a KoinComponent, inject the class by providing it a parameter of same type in parametersOf()
Notice that the parameter of same type is returned
Expected behavior
We expect to be able to pass a parameter of same type to a factory instance while still having a new instance created
Koin module and version:
koin-core:4.0.2
koin-annotations:2.0.0-Beta3
Snippet or Sample project to help reproduce
@Factory
classInjectedClass
classComponent : KoinComponent {
val parameter:InjectedClassval injected:InjectedClass by inject {
parametersOf(parameter)
}
}
The text was updated successfully, but these errors were encountered:
Describe the bug
Since Koin 4.0.x, when injecting an instance tagged as a
@Factory
using theinject
function in aKoinComponent
, the first parameter of same type is returned instead of being actually passed as a parameter of the requested factory instance (seeresolveFromContext()
inside theScope
class).This behaviour started occurring when migrating from 3.x.x to 4.0.x.
To Reproduce
@Factory
annotationKoinComponent
, inject the class by providing it a parameter of same type inparametersOf()
Expected behavior
We expect to be able to pass a parameter of same type to a factory instance while still having a new instance created
Koin module and version:
koin-core:4.0.2
koin-annotations:2.0.0-Beta3
Snippet or Sample project to help reproduce
The text was updated successfully, but these errors were encountered: