Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

onAuthStateChange fires every time we focus the tabΒ #579

@altryne

Description

@altryne

Bug report

Describe the bug

onAuthStateChange fires every time we blur (go to a different tab) and focus on the tab with supabase

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to https://n3-supabase.netlify.app/
  2. Log in
  3. Open devtools network tab
  4. blur (go to a different tab)
  5. focus (go back to the tab with an active supabase.js auth session)
  6. network shows a new request to /api/_supabase/session on every focus event
  7. no state was changed, but onAuthStateChange was fired which triggered the request in nuxt

Expected behavior

onAuthStateChange fires only when the state actually changes

Screenshots

CleanShot 2022-12-21 at 13 56 15@2x

System information

  • OS: macOS
  • Version of nuxt-supabase - "@nuxtjs/supabase": "^0.3.0",

Additional context

This doesn't seem to be a nuxt problem as it only subscribes once to the onAuthStateChange

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions