Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providers dispose after log out #3619

Open
henriqueArrazao opened this issue Jun 18, 2024 · 0 comments
Open

Providers dispose after log out #3619

henriqueArrazao opened this issue Jun 18, 2024 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation needs triage

Comments

@henriqueArrazao
Copy link

I have a "SessionNotifier" (stores userToken and Firebase remote config data for example) that should never be disposed. So it is inside of the first Scope.
I have another ProviderScope for the HomeScreen (when the user is already logged). So I thought, when the HomeScreen is disposed, all the providers with the stored data of the user, e.g. "to do" list, "categories" list, etc would be disposed as well. But it does not happen.
So I started using the "UncontrolledProviderScope", but now, but the only disposed providers are the ones in HomePage, ignoring the ones of further screens. So I would need to wrap every single route in a scope? And another thing, I needed to create a GlobalKey to access the providers from previous Scopes, otherwise it would duplicate them.
Either I'm not used to the way RiverPod manages this (I used to be very happy using the GetIt scopes), or I find their behavior very strange.
Basically, how do I make to all providers created after the login to be disposed in the "riverpod way"? Is there any example out there? Thanks.

@henriqueArrazao henriqueArrazao added documentation Improvements or additions to documentation needs triage labels Jun 18, 2024
@henriqueArrazao henriqueArrazao changed the title Providers after login dispose Providers dispose after log out Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation needs triage
Projects
None yet
Development

No branches or pull requests

2 participants