-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
feat: Broadcast auth events to other tabs on web #1005
Conversation
I couldn't find a way to do automated testing for this. I only tested this manually with a little modified flutter example app. I didn't test the compatibility with the js package as well. Maybe you have a ready to go setup for a flutter and js app on the same domain. The auth-js doesn't have this, but I think it would be useful to add a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a screen recording that shows how this PR works?
I do not currently, but I'm unsure how that helps you. I've added logging to the onAuthStateChange stream and saw that when I log in in one tab, the other tabs received the same |
I want to verify the behavior. It would be awesome if you could do a quick screen recording verifying that this PR works as intended. |
I tried a different example app and indeed found the issue of not properly saving the session if it's null. Should be fixed now. Here's the recording as well: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the awesome PR! Just had a few small questions, but it looks amazing and sorry for taking time to get back to this one.
What kind of change does this PR introduce?
feature
What is the current behavior?
When singing in or out in a tab on flutter web, the other tabs of the same domain are untouched.
What is the new behavior?
Every auth event and their session is distributed to the other tabs via the web broadcast channel feature. The js library does this as well.
I've noticed that auth-js doesn't contain the
userDeleted
event, but found no use in our library as well. It got added here, but I don't see why. So I marked it as deprecated.Furthermore, from what I see, the auth refresh token and streams got nowhere closed, so I added a
dispose()
method and call it from the dispose method in thesupabase
package.Additional context
close #979