myScopeContainerObject.scope.close() is not working?
See original GitHub issueDescribe the bug
Koin version: 2.1.5
myScopeContainerObject.scope.close()
behave differently from
val scope = myScopeContainerObject.scope
scope.close
To Reproduce I have an the below scope Object
scope<MyObject> {
scoped { Presenter() }
}
When I close it, getting it on will crash as expected.
val myScope = myObject.scope
val presenter = myScope.get<Presenter>(Presenter::class.java)
myScope.close()
val presenter2 = myScope.get<Presenter>(Presenter::class.java) // Crash here.
However if I don’t assign out, but close it too. It still works.
val presenter = myObject.scope.get<Presenter>(Presenter::class.java)
myObject.scope.close()
val presenter2 = myObject.scope.get<Presenter>(Presenter::class.java)
// presenter1 == presenter2
I still can get my presenter
the same copy as I get before I close it.
I think there’s a bug somewhere.
More description in https://stackoverflow.com/questions/61321896/koin-why-after-myobject-scope-close-it-still-works
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Kotlin Koin Scope Illustrated - Medium
myScopeContainerObject.scope.close() is not working? · Issue #786 · InsertKoinIO/koin. You can't perform that action at this time.
Read more >Scope issues with Angular UI modal - Stack Overflow
Hi, this solved my problem for a while, but noticed a weird thing when closing the modal/dialog, content was changing and it seemed...
Read more >Solved: HR case is not getting close complete from work In...
Hello All,. when a we changes the HR Case state to Closed complete the case record shows as complete and state changes back...
Read more >Issue with Close workbook activity - UiPath Forum
Hello, My coding has issues with the closing activity of the Excel. ... that is in scope and not null when using close...
Read more >SM Work Order Close Form - Viewpoint Help
Selecting Yes closes the work order and all of its open scopes. Once closed, you can no longer add new scopes or trips,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
.scope
is more a shortcut forgetOrCreateScope
for the given instanceAfter trying further, the
myObject.scope.close()
do work. And the previously assignedmyScope
will not work anymore. Just that when one performmyObject.scope
, it will generate a new one.This make sense. One just have to be careful, else it will be confusing. Closing the issue.