firebase / firebase/firebase-js-sdk
Firebase Auth keeps browser tabs active while in the background
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: macOS Big Sur
* Browser version: Chrome 89, Safari 14.0.3
* Firebase SDK version: 8.2.7
* Firebase Product: Auth
### [REQUIRED] Describe the problem
Firebase auth wakes up a background tab every 10s or so even when there's no activity in the firebase tab (e.g. via realtime database or firestore). This shows up in Safari as having a constant power usage and prevents low-power states for that tab.
I imagine this is due to refreshing auth tokens, but it would be nice to bring the power usage and tab wake ups down to 0 if indeed there's no activity happening.
#### Steps to reproduce:
- Log in to a firebase app in chrome that isn't getting any updates from RTDB or Firestore
- Start the CPU profiler in devtools
- Leave the tab in the background and stop the profiler after a few minutes
- You should see something like this:

- Most of these spikes are attributed to firebase auth

- Login to the same firebase app in safari
- Open the devtools, and record a timeline that includes cpu usage
- It should look like this

#### Relevant Code:
Any logged in firebase session.
Contributor guide
Assessment
This issue has not been assessed yet.