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
When Visibility Change window events are triggered, the SIGNED_IN AuthEvent is triggered. This causes a rewrite of Session in supabase-js's SessionContextProvider, which is suggested to be the top level Context in _app.js for Next.js applications. Thus, it causes a re-render of the web application every time the visibility changed. This happens only when the session token is still valid and hasn't expired. It appears to have been introduced while fixing a React Native error in #76.
To Reproduce
Open a tab with Supabase loaded in an application. Move away from the tab, switch back to the tab. The application will re-render. For further proof, check this code out:
Bug report
Describe the bug
When Visibility Change window events are triggered, the SIGNED_IN AuthEvent is triggered. This causes a rewrite of Session in
supabase-js
's SessionContextProvider, which is suggested to be the top level Context in_app.js
for Next.js applications. Thus, it causes a re-render of the web application every time the visibility changed. This happens only when the session token is still valid and hasn't expired. It appears to have been introduced while fixing a React Native error in #76.To Reproduce
Open a tab with Supabase loaded in an application. Move away from the tab, switch back to the tab. The application will re-render. For further proof, check this code out:
https://github.com/supabase/auth-helpers/blob/2a85f3db6815b8baf7ff44d48c4fc54e2bfba210/packages/react/src/components/SessionContext.tsx#L83-L94
Actual event triggered:
https://github.com/supabase/gotrue-js/blob/2fc278106c1b2b4f4d45d75c9ad3f02588af1cbe/src/GoTrueClient.ts#L1130-L1133
From this callback:
https://github.com/supabase/gotrue-js/blob/2fc278106c1b2b4f4d45d75c9ad3f02588af1cbe/src/GoTrueClient.ts#L1373-L1375
One could also use
supabase.auth.onAuthStateChange
and print all events to see them triggered.Expected behavior
If the session's access token is unchanged, don't trigger a SIGNED_IN AuthEvent.
System information
The text was updated successfully, but these errors were encountered: