Supabase client stops working after switching browser tabs (works only after refresh)

Hi Supabase team,

I'm running into an issue with @supabase/supabase-js in a Vite + Svelte app.

The client works fine at first, but when I switch to another browser tab and then return, Supabase methods stop working — for example, supabase.auth.getSession() or any supabase.from(...).select() calls do nothing. It's like the client is no longer active. However, if I reload the page, everything works again.

I want the Supabase client to keep working without a full reload when the user returns to the tab. I've tried manually reinitializing the client on window.focus, but that didn't help.

What could be causing this? Is this a known issue with how Supabase handles tab visibility or backgrounded tabs?

Thanks in advance!
Was this page helpful?