Skip to content

Commit 35e0a98

Browse files
authored
zone log verbosity (#3613)
* Bunch of stuff * Bump firebase * Cleanup
1 parent 8ce95bf commit 35e0a98

31 files changed

+771
-682
lines changed

docs/zones.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,26 @@ Observables, Promise-based APIs, and those with callbacks will purposely destabi
1414

1515
When using a Firebase or RxFire API without importing from AngularFire or if AngularFire APIs are used outside of an injection context you _may_ experience instability.
1616

17-
instability can be difficult to track down ([see Resolving zone pollution in the Angular docs](https://angular.dev/best-practices/zone-pollution)). To help with debugging, AngularFire emits warnings when it is unable to Zone wrap an API while in dev-mode. **Often these messages can be safely ignored** but we'd rather be verbose.
18-
1917
When an application is unstable change-detection, two-way binding, and rehydration may not work as expected—leading to both subtle and non-subtle bugs in your application. Further, server-side rendering (SSR) and static site generation (SSG/pre-rendering) may timeout or render a blank page.
2018

2119
There are a number of situations where AngularFire's Zone wrapping is inconsequential such adding/deleting/updating a document in response to user-input, signing a user in, calling a Cloud Function, etc. So long as no long-lived side-effects are kicked off, your application should be ok. Most Promise based APIs are fairly safe without zone wrapping.
20+
21+
## Logging
22+
23+
You may see a log warning, `Calling Firebase APIs outside of an Injection context may destabilize your application leading to subtle change-detection and hydration bugs. Find more at https://github.com/angular/angularfire/blob/main/docs/zones.md` when developing your application.
24+
25+
Instability can be difficult to track down. To help with debugging, AngularFire emits warnings when it is unable to Zone wrap an API while in dev-mode. **Often these messages can be safely ignored** but we'd rather be verbose.
26+
27+
There are three logging levels in AngularFire:
28+
29+
* **Silent**: when the logging level is set to silent only the above banner is displayed when AngularFire APIs are called outside of an injection context, this is the default when using Zoneless change-detection.
30+
* **Warn**: when the logging level is set to warn, only blocking reads, long-lived tasks, and APIs with high risk of destabilizing your application are called, this is the default when using ZoneJS.
31+
* **Verbose**: when the logging level is set to verbose, all AngularFire APIs called outside of an injection context are logged—helping you track down APIs that may be destabilizing your application
32+
33+
You can change the log-level like so:
34+
35+
```ts
36+
import { setLogLevel, LogLevel } from "@angular/fire";
37+
38+
setLogLevel(LogLevel.VERBOSE);
39+
```

package-lock.json

+202-201
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@angular/router": "^19.0.0",
5757
"@schematics/angular": "^19.0.0",
5858
"esbuild": "^0.24.0",
59-
"firebase": "^11.0.0",
59+
"firebase": "^11.2.0",
6060
"firebase-functions": "^6.1.0",
6161
"fs-extra": "^8.0.1",
6262
"fuzzy": "^0.1.3",
@@ -118,9 +118,5 @@
118118
"tslint": "~6.1.0",
119119
"typescript": ">=5.5 <5.7"
120120
},
121-
"overrides": {
122-
"@angular/compiler-cli": "^19.0.0",
123-
"firebase": "^11.0.0"
124-
},
125121
"typings": "index.d.ts"
126122
}

0 commit comments

Comments
 (0)