Title: chore(sample): update the sample app to Angular 22 by armando-navarro · Pull Request #3845 · angular/angularfire · GitHub
Open Graph Title: chore(sample): update the sample app to Angular 22 by armando-navarro · Pull Request #3845 · angular/angularfire
X Title: chore(sample): update the sample app to Angular 22 by armando-navarro · Pull Request #3845 · angular/angularfire
Description: Checklist Issue number for this PR: Refs #3669, Refs #3843 Docs included?: the sample's own README.md is updated. No library docs change. Test units included?: yes, the sample's two spec files (4 tests). app.component.spec.ts is updated for the new providers and name. Breaking change?: no. The library is untouched. In a clean directory, yarn install, yarn test run successfully?: yes, with npm, inside sample/ on Node 24: npm install ../angular-fire-22.0.0.tgz, ng build, ng test (2 files, 4 tests). Description Carries sample/ from Angular 21 to Angular 22, the way #3671 carried it from 19 to 21: ng update @angular/core@22 @angular/cli@22 Hand edits that match what ng new 22 generates AngularFire library installed from the tarball the root build produces. It also moves the sample's server-rendering setup to initializeBrowserOrServerApp from #3844, which replaces the hand-written server-app factory and releases the server app the old factory never released. Changes @angular/* 22.2, TypeScript 6.0, firebase 13, vitest 5, jsdom 30, @types/node 22, the ng22-test name, and Node 24 (firebase 13's packages require it). app.config.ts matches the 22 scaffold: provideBrowserGlobalErrorListeners() added provideZonelessChangeDetection() dropped (zoneless is the default) provideClientHydration() without withIncrementalHydration() (incremental hydration is the default). The spec drops the same two providers. Removed ChangeDetectionStrategy.Eager that Angular's change-detection-eager migration added to all nine components again (so it does not appear in the diff), and the sample runs on Angular 22's OnPush default. app.config.ts: one provideFirebaseApp(() => initializeBrowserOrServerApp(environment.firebase)) for both platforms, as step 4 of the Authentication guide shows. In the browser the helper returns the ordinary Firebase app. On the server it reads the ID token from the request context that server.ts already passes to handle(), builds a Firebase server app for a signed-in render and the ordinary app otherwise, and releases the server app once the render is garbage-collected. app.config.client.ts is deleted. Its browser-only providers (Analytics with the two tracking services, Messaging, Performance) move to app.config.ts, since each already provides nothing on the server, and main.ts bootstraps from appConfig, as ng new does. app.config.server.ts keeps only provideServerRendering. Calls to functions AngularFire does not wrap (doc, collection, query, orderBy, increment, serverTimestamp) sit outside runInInjectionContext, with a one-line comment on each. Only the wrapped functions, sign-in and sign-out calls run inside it. GoogleAuthProvider, onIdTokenChanged and signInWithPopup are imported from @angular/fire/auth. onAuthStateChanged stays the SDK's own inside the sample's authState, which applies the wrapper to the whole function. server.ts keeps the trustProxyHeaders: ['x-forwarded-host', 'x-forwarded-proto'] the trust-proxy-headers migration wrote, with a comment in place of its TODO. angular.json: security.allowedHosts gains localhost. Angular 22 gives a 400 Bad Request error to any host not on that list (Angular 21 logged an error and fell back to client-side rendering), and it was empty, so npm run serve:ssr:ng22-test could not be reached locally. README.md has a "Running the server build" section that says deployments add their hostnames there or in NG_ALLOWED_HOSTS. tsconfig.app.json keeps the extendedDiagnostics block the strict-safe-navigation-narrow migration wrote. functions/package.json moves to the Node 24 runtime. Both package-lock.json files regenerated with npm 10. Behavior to know The sample now needs Node 24.15 or later. On Node 22 the install prints EBADENGINE warnings for the firebase packages. Verification ng build and ng test (2 files, 4 tests) on Node 24.22.2, with one copy of firebase (npm ls firebase). Emulator session (firebase emulators:exec --import seed with the production server bundle): signed-out server render with the eight demos in the HTML, anonymous sign-in, an upboat write, the Cloud Function call, sign-out, then a signed-in server render whose HTML carries the uid. No AngularFire warning or error in the browser console or the server log. The same under ng serve, where AngularFire's injection-context warning prints: sign-in, a write and the function call with no AngularFire warning. The hydration log reports the seven @defer blocks on incremental hydration. npm run build of the Cloud Function from its regenerated lockfile. Not exercised: "New animal" (a window.prompt), "Log in with Google" (a real provider popup), Messaging (no token flow in the emulators).
Open Graph Description: Checklist Issue number for this PR: Refs #3669, Refs #3843 Docs included?: the sample's own README.md is updated. No library docs change. Test units included?: yes, the sample's two spec f...
X Description: Checklist Issue number for this PR: Refs #3669, Refs #3843 Docs included?: the sample's own README.md is updated. No library docs change. Test units included?: yes, the sample's tw...
Opengraph URL: https://github.com/angular/angularfire/pull/3845
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a25a617a-0664-5fa0-62e9-c7e5502064c7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 992E:10AD06:22ABF0F:2DE75E0:6B036088 |
| html-safe-nonce | 0c485865ffc8b7246ea83cbb40b784828d2d8e389736fced2a2af6a900936bac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTJFOjEwQUQwNjoyMkFCRjBGOjJERTc1RTA6NkIwMzYwODgiLCJ2aXNpdG9yX2lkIjoiNzU0MzM1MDQ1MzU5ODM4MDE2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ba785b686b106ec592db668ebdca43d731b5702cb62fa8209dd93edfd06599ed |
| hovercard-subject-tag | pull_request:5251856294 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/angular/angularfire/pull/3845/files |
| twitter:image | https://avatars.githubusercontent.com/u/13904589?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/13904589?s=400&v=4 |
| og:image:alt | Checklist Issue number for this PR: Refs #3669, Refs #3843 Docs included?: the sample's own README.md is updated. No library docs change. Test units included?: yes, the sample's two spec f... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width