supabase / supabase-flutter

Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.
https://supabase.com/
MIT License
662 stars 155 forks source link

fix(gotrue): Set _currentUser when setting initial session #806

Closed dshukertjr closed 5 months ago

dshukertjr commented 5 months ago

What kind of change does this PR introduce?

Currently when the supabase_flutter SDK obtains the initial session from local storage and calls setInitialSession() method of gotrue, the _currentUser is not set causing a state where auth.currentSession is not null, but auth.currentUser being null. This PR fixes it.

Related https://github.com/supabase/supabase-flutter/issues/805

elliottetzkorn commented 5 months ago

Realizing that I was relying on currentUser and not currentSession for my UI management. This is honestly probably the root of all my issues here https://github.com/supabase/supabase-flutter/issues/805.