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
From looking at the source code I think the onClose callback is not implemented for root definitions. It's only called once in the codebase when a scope is closed.
This seems like a major problem, but apparently not many people are using onClose? 🤔
To better understand this: Is this actually a bug or is onClose actually not supposed to work for the root scope of a module? Having some way of automatically cleaning up components in a callback like onClose would be really beneficial when unloading a module, no matther if the definitions inside were further isolated in a sub-scope or not.
If this is a bug that needs to be fixed I'd be willing to have a look at it when I get the time.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
For me this seems like a bug, it's weird that you can define an onClose method which isn't actually called when closing. And I don't see a reason why this shouldn't work for the root scope of a module. But I might be wrong, my understanding of Koin is limited.
For me this seems like a bug, it's weird that you can define an onClose method which isn't actually called when closing. And I don't see a reason why this shouldn't work for the root scope of a module. But I might be wrong, my understanding of Koin is limited.
not a bug, as for now single definitions need to be dropped with module unloading, not closing it. It's more an issue to be able to write onClose on it ... as it would be only on Scoped definitions.
Activity
Reevn commentedon Jul 30, 2020
From looking at the source code I think the
onClose
callback is not implemented for root definitions. It's only called once in the codebase when a scope is closed.This seems like a major problem, but apparently not many people are using
onClose
? 🤔dima-zemingo commentedon Aug 3, 2020
So will it be fixed? Because if you have this functionality, it should work or move the onClose to only support for Scope defenition
Reevn commentedon Apr 6, 2021
To better understand this: Is this actually a bug or is
onClose
actually not supposed to work for the root scope of a module? Having some way of automatically cleaning up components in a callback likeonClose
would be really beneficial when unloading a module, no matther if the definitions inside were further isolated in a sub-scope or not.If this is a bug that needs to be fixed I'd be willing to have a look at it when I get the time.
stale commentedon Mar 23, 2022
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
grabarczyk-t commentedon Mar 23, 2022
For me this seems like a bug, it's weird that you can define an onClose method which isn't actually called when closing. And I don't see a reason why this shouldn't work for the root scope of a module. But I might be wrong, my understanding of Koin is limited.
arnaudgiuliani commentedon Aug 29, 2022
not a bug, as for now single definitions need to be dropped with module unloading, not closing it. It's more an issue to be able to write
onClose
on it ... as it would be only on Scoped definitions.arnaudgiuliani commentedon Dec 13, 2022
This issue is outdated. The following test is running successfully: