getSession initially returns null session, which leads to incorrect rendering

Hi all, I'm using supabase-js with react, and have a user avatar/login button being conditionally rendered in the navbar based on if the session exists for a logged in user. However, getSession initially returns null before getting the session, which means the login button is shown before quickly changing to the avatar anytime the user goes to a different view.

How can I resolve this?
Was this page helpful?