Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

fix: prevent AuthState signedIn with null session #133

Merged
merged 6 commits into from Mar 30, 2023

Conversation

rokk4
Copy link
Contributor

@rokk4 rokk4 commented Mar 29, 2023

What kind of change does this PR introduce?

If _notifyAllSubscribersis called before _saveSession, then the session of the emitted AuthState will be null, because it uses _currentSession which is still null if _saveSession has not been called.

What is the current behavior?

With #127 the session of the emitted AuthState is null.

What is the new behavior?

Same as before #127 , emitted AuthState contains the corresponding session.

Additional context

If   _notifyAllSubscribers is called before _saveSession, then the session of the emitted authstate will be null, because it uses _currentSession which is still null if _saveSession has not been called.
Copy link
Contributor

@Vinzent03 Vinzent03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

lib/src/gotrue_client.dart Outdated Show resolved Hide resolved
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the amazing catch! I have fixed the code format issue. Let me bump the version and do a release right now!

@dshukertjr dshukertjr merged commit c7f3feb into supabase:main Mar 30, 2023
4 checks passed
@rokk4 rokk4 deleted the patch-1 branch March 30, 2023 06:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants