Conversation
|
It is a missing feature. I have been using stuff like below which I am nervous about. It would be good to use it legally. 😀 |
|
I have always been pretty leery of this feature. I get that it might be useful for testing, but I fear that it would create situations where an object can be resolved but not be able to be resolved later. @Xapphire13, what do you think? |
|
Hi guys, any update on this Pull Request? We need this feature in our React application to remove a ViewModel Singleton class from memory when a component is destroyed. |
@wagnercsfilho we are waiting for @Xapphire13 feedback. |
|
Alright, I think we can accept this PR - please update the readme, and I'll accept it and push out a new version this week. You may need to rebase too (I'm not totally sure) |
@MeltingMosaic I pulled the latest updates and added a description for the |
|
@wladimirgrf updates about this? |
Hi @wagnercsfilho. No updates. |
|
Just sharing what I'm facing with the tsyringe and AWS lambdas. Every request, I need to register a runtime value to be used inside the lambda code, that's ok and works perfectly. But when a next request comes in, the value registered in the last request is still present and in this scenario it can be considered as a data leak. In this case I cannot allow a value from a previous request to be present in the next requests. That's why I need the This is not a big problem yet because I'm overwriting the old runtime value in every request. But there could be other scenarios that can be very problematic. |
|
Added this to tsyringe-neo |
|
@junioramilson For your use case, you should use a child container for each lambda request and register only in the child container the value that you want just for this request. |
There are features in tsyringe for removing/cleaning all instances. It is not possible to choose a specific token to delete.
This pull request enables unregister a token. Solving two issues:
.reset()removes all registrations #82Example
The
test1should log the message without any problems, however thetest2will return an error message:Attempted to resolve unregistered dependency token...Because unregister removed the corresponding key.