2
Expand useUser to have isLoading state like useSessionContext
Source: supabase/supabase#13221 · opened by @gurkang
For checking if a user is logged in and if I can/should be fetching data I initially check in a useEffect like this:
But the only reason I have to use useSessionContext here is because useUser can return null while it's loading the session/user.
If useUser exposed a loading state it could be simplified down to:
I think it's more convenient to do it this way and only having to use useUser hook to check on clientSide if the user is logged in and has an active session.
But the only reason I have to use useSessionContext here is because useUser can return null while it's loading the session/user.
If useUser exposed a loading state it could be simplified down to:
I think it's more convenient to do it this way and only having to use useUser hook to check on clientSide if the user is logged in and has an active session.
No pledges yet. Be the first to back this.
Comments
Similar requests
Consider adding an option to refetch updated data for `useUser()`
2 votes · 0 comments
Add Custom Claims from Auth Hook to useSession() and useUser()
1 vote · 0 comments
useUser in auth-helper need to update `is_anonymous` key doesn't exist.
1 vote · 0 comments
supabase/ssr add useJWT, useSession, useUser hooks for react
2 votes · 0 comments
Improve Column Name Copying and Visibility in Tables
1 vote · 0 comments
No comments yet.