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

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

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/gotrue/lib/src/gotrue_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ class GoTrueClient {
Map<String, String> get headers => _headers;

/// Returns the current logged in user, if any;
///
/// Use [currentSession] to determine whether the user has an active session,
/// because [currentUser] can be non-null without an active session, such as
/// when the user signed up using email and password but has not confirmed
/// their email address.
User? get currentUser => _currentUser;

/// Returns the current session, if any;
Expand Down Expand Up @@ -901,6 +906,7 @@ class GoTrueClient {
}

_currentSession = session;
_currentUser = session.user;
notifyAllSubscribers(AuthChangeEvent.initialSession);
}

Expand Down
Loading