How to clear the DependencyValues? #382
Replies: 1 comment
-
|
I came here to ask a similar question. Our app resets a stack of "manager" dependencies whenever the session changes (log in/out). We've started writing all new features in TCA and have made the manager dependencies available with @dependency, which is convenient. However we need a way to reset the cached dependencies on log in/out. Look through the Dependencies code I found However it requires @mbrandonw what do you think about bringing that back? Or is there a different/recommended way to reset the cache? I think I saw in another thread that it was recommended for dependencies to manage resetting their own state, however that's not an option in our large legacy codebase (and seems error-prone anyway) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Guys,
I really need your suggestion here. So let's say I use
ConfigDataSourceas a dependency inside mySignInReducer.When the user logs out of the app, I want to completely clear the configDataSource from the
DependencyValues._currentso that when the user logs in again, I can reinitialize with new config values.Basically, my goal is to flush out the DepedencyValues completely and start as fresh.
I tried to use withDependencies and wrapped my root reducer as following when the user logs out.
However, it looks like my previous configDataSource never got deallocated. Pls assist. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions