You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(auth): add deprecation notice to onAuthStateChange with async function (#1580)
If you pass in an async function to `onAuthStateChange` and call a Supabase Client API, it's very likely you'll end up with a deadlock. Example: ```typescript supabase.auth.onAuthStateChange(async () => { await supabase.auth.getClaims() }) ``` This is because: - `onAuthStateChange` runs inside an exclusive lock - If you call another API that tries to acquire the exclusive lock, the initial call will never finish, thereby never releasing the first lock, and no other Auth API can be called (across all tabs) Multiple attempts were made to detect these situations but it's not easy as async functions don't track execution context in all environments properly. This change adds a deprecation notice if the callback is an async function to discourage folks from using it, and hopefully make it a bit faster to realize why suddenly everything is frozen.
0 commit comments