Skip to content

fix(gotrue): Ensure a single initialSession is emitted. #975

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

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

dshukertjr
Copy link
Member

What kind of change does this PR introduce?

Fixing a bug where two initialSession is emitted. Also fixing a bug where deeplink isn't handled on the web.

Closes #937
Closes #974

Supabase.instance.client.auth.setInitialSession(persistedSession);
await Supabase.instance.client.auth
.setInitialSession(persistedSession);
shouldEmitInitialSession = false;
Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason the shouldEmitInitialSession was never set to false, causing the initialSession to be emitted every single time.

Comment on lines +69 to +73
if (shouldEmitInitialSession) {
Supabase.instance.client.auth
// ignore: invalid_use_of_internal_member
.notifyAllSubscribers(AuthChangeEvent.initialSession);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving this before the deep link handling to ensure the empty initial session is emitted first.

@dshukertjr dshukertjr merged commit 6323f9f into main Jul 19, 2024
3 checks passed
@dshukertjr dshukertjr deleted the fix/duplicate-initial-session branch July 19, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supabase Auth on Flutter Web does not detect access token in url (Google & Apple) Handling initial deeplink in password recovery
2 participants