Repository navigation
Commit 2179320
authored
fix(telemetry): register React and ReactFire versions at import time (#835)
ReactFire registered the React and ReactFire versions with Firebase only
when FirebaseAppProvider initialized a new app from firebaseConfig. Apps
that passed firebaseApp, reused an initialized app, or called hooks
without the provider reported no React or ReactFire version.
src/telemetry.ts adds registerReactFireVersion, which registers both
versions with registerVersion and runs at import time.
FirebaseAppProvider (ahead of its early returns) and useObservable also
call it as a fallback.
Firebase's heartbeat records the registered versions once per UTC day,
at the first _getProvider call (the first getFirestore(), getAuth(), and
so on). Registering at import time therefore covers apps that create SDK
instances at module scope, unless their entry file imports that setup
before ReactFire. Those apps still go uncounted, so heartbeat counts are
a lower bound.
registerReactFireVersion checks Firebase's internal _components map
before registering, so repeated calls do not log "There were multiple
attempts to register component" at debug level. If that map is
unavailable, a module-level flag prevents repeat calls instead. The
function never throws, so a partially mocked or badly bundled
firebase/app cannot break importing or rendering ReactFire.1 parent 711828c commit 2179320
14 files changed
Lines changed: 226 additions & 30 deletions
File tree
- docs/reference
- functions
- interfaces
- variables
- src
- test
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
| |||
0 commit comments