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

Flash of LoginComponent on Page Load Due to Initial Null User State #19

Open
Jacksonmills opened this issue Feb 5, 2024 · 3 comments · Fixed by #75
Open

Flash of LoginComponent on Page Load Due to Initial Null User State #19

Jacksonmills opened this issue Feb 5, 2024 · 3 comments · Fixed by #75

Comments

@Jacksonmills
Copy link
Collaborator

When the page loads, there is a brief flash of the LoginComponent before the user's authentication status is confirmed. This occurs because the initial state of the user in our authentication hook is set to null, and it takes a moment for the hook to update this state based on the user's session. This flash can be jarring and confusing for users who are already logged in.

Steps to Reproduce

Open the application while already logged in.
Observe that the LoginComponent briefly appears before being replaced by the main content.

Expected Behavior

The LoginComponent should not appear if the user is already authenticated and has an active session.

Actual Behavior

The LoginComponent flashes briefly on page load, even when the user is authenticated.

@Jacksonmills
Copy link
Collaborator Author

current idea: we decouple token/url and email/password? make it sort of a two step? that way we set up the supabaseClient before needing to do auth, maybe this way we can use the auth helpers Supabase provides? @adamcohenhillel thoughts if that could help? Might not fix the flashing at first but maybe once we can assume there is the supabaseClient it would make auth cleaner no?

@Jacksonmills
Copy link
Collaborator Author

In my testing the flash still exists even with the loading check 🤔

@Jacksonmills
Copy link
Collaborator Author

First login is always fine, then if you reload or come back while logged in it flashes. So maybe that's the real edge case to test

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 a pull request may close this issue.

1 participant