FirebaseExtended / reactfire

Hooks, Context Providers, and Components that make it easy to interact with Firebase.
https://firebaseopensource.com/projects/firebaseextended/reactfire/
MIT License
3.51k stars 399 forks source link

High CPU usage with constant GC with `useInitFirestore` #541

Closed Zeta611 closed 2 years ago

Zeta611 commented 2 years ago

Version info

The most recent versions:

React: 18.2.0

Firebase: 9.9.2

ReactFire: 4.2.2

Other (e.g. Node, browser, operating system) (if applicable): I reproduced this on my macOS Monterey using Firefox and Safari

Test case

This is basically the same as the example provided in the tutorial for accessing data offline, and there seems to be a some sort of infinite rendering? IMHO, this is a major resource issue..

https://stackblitz.com/edit/reactfire-v4-sample-k9jyyq?file=index.js

Steps to reproduce

If you open the project, it shows constantly high CPU usage. When you comment out the await enableIndexedDbPersistence(db); (line 30), it works fine.

Expected behavior

It should not hog the CPU.

Actual behavior

It does.

Zeta611 commented 2 years ago

Perhaps this is an issue with enableIndexedDbPersistence or a perfectly normal behavior?