Skip to content

feat: add Angular 22 support - #3741

Open
EthanSK wants to merge 1 commit into
angular:mainfrom
EthanSK:codex/angular-22-support
Open

EthanSK wants to merge 1 commit into
angular:mainfrom
EthanSK:codex/angular-22-support

Conversation

@EthanSK

@EthanSK EthanSK commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • update AngularFire package and peer dependencies to Angular 22, TypeScript 6, Zone.js 0.16, and the Node versions supported by Angular 22
  • replace the removed ComponentFactoryResolver dependency in modular and compat Analytics screen tracking with reflectComponentType
  • migrate the TypeScript, Angular ESLint, Zone.js, and CommonJS schematics setup required by the Angular 22 toolchain
  • add a focused lazy-route screen-tracking regression test with isolated router location state

Fixes #3696

Compatibility notes

  • removing ComponentFactoryResolver changes the constructor signature of both ScreenTrackingService implementations and the internal ɵscreenViewEvent signature; Angular DI consumers are unaffected, while callers that construct these classes directly must remove that argument
  • src/schematics/package.json is intentional: the distributed package is ESM, while the schematics are compiled as CommonJS and need the nested package marker to load through ng add and ng update
  • routed values without Angular component metadata are ignored instead of terminating the long-lived Analytics subscription

Verification

  • npm ci
  • npm run lint
  • npm run build
  • npm run build:jasmine && npm run test:node-esm (226 specs)
  • focused ChromeHeadless lazy-route screen-tracking spec (1 spec)
  • installed the packed 22.0.0-rc.0 tarball in a fresh strict Angular 22 consumer and completed a production build using provideAnalytics, ScreenTrackingService, and UserTrackingService

The full emulator-backed browser matrix is left to this repository's GitHub Actions run because a shared Firebase Storage emulator is already active locally.

@EthanSK

EthanSK commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

The change is ready and locally validated, but the Test and publish workflow is currently marked action_required before any jobs start because this fork needs maintainer approval to run Actions. Could a maintainer approve the workflow run when convenient? Thank you.

@armando-navarro armando-navarro added bump: major Size of the change: breaking, ships only in a major release comp: analytics Google Analytics (src/analytics). comp: build/pipeline Build, bundling, packaging, release pipeline. type: feature New capability or enhancement. labels Aug 11, 2026
@EthanSK
EthanSK force-pushed the codex/angular-22-support branch 2 times, most recently from cb924f9 to 18009c1 Compare August 15, 2026 13:49
@EthanSK
EthanSK force-pushed the codex/angular-22-support branch from 18009c1 to 1ddf87d Compare August 21, 2026 14:13
@KingDarBoja

Copy link
Copy Markdown
Contributor

The change is ready and locally validated, but the Test and publish workflow is currently marked action_required before any jobs start because this fork needs maintainer approval to run Actions. Could a maintainer approve the workflow run when convenient? Thank you.

Have you tried the "actions" tab at your forked repository? I believe you can run those workflows over there if you want to try out the "test and publish" workflow :)

@armando-navarro armando-navarro added the breaking change Upgrading apps must change something. Call it out in the release notes label Oct 7, 2026
@armando-navarro armando-navarro added this to the 22.0.0 milestone Oct 7, 2026
@armando-navarro

Copy link
Copy Markdown
Collaborator

Hi @EthanSK, thanks for this, and sorry for the long silence. I am the new maintainer, and this PR was triaged the day it opened but then held while we got 21.0.0-rc.1 out. That release is on npm now, so I can give you a real answer.

Here's what I found:

What your PR already gets right

  • reflectComponentType(component)?.selector is the correct replacement for the removed ComponentFactoryResolver, in both screen-tracking services.
  • The src/test.ts zone.js imports have to move to zone.js, zone.js/testing and zone.js/plugins/task-tracking. TypeScript 6 now errors on the old paths, where 5 ignored them.
  • The two prefer-optional-chain fixes and the Node matrix change are needed as is.

What changed since you submitted this PR

  • main moved to Angular 21.2 and firebase 12.18, so package.json, src/package.json and the lockfile now conflict.
  • ng-packagr 22.2 switched its typings bundler, and the build now fails on src/compat/storage/observable/fromTask.ts until that function gets an explicit return type.
  • src/package.json on main now declares "type": "commonjs", which makes the new src/schematics/package.json in the PR unnecessary.
  • We keep the version field at the last released version and let tags drive publishing, so the move to 22.0.0-rc.0 would need to come out.

Where this goes next

I cannot merge any Angular 22 change into main yet, because every merge there publishes a canary and 21.0.0 has not been tagged. The plan is to cut a 21.0.x branch for the 21.0.0 release shortly and open main to Angular 22 work right after that. I will post the details on #3696 once the branch exists.

So two ways forward, and I am fine with either:

  • You refresh this branch against main once I post that the 21.0.x branch is cut, and I review it then.
  • I fold your changes into a fresh pull request, with you as co-author on the commit and credited in the release notes, and link it from here before closing this one.

Let me know which you prefer. If I do not hear back by October 14, I'll go ahead with the second option and say so here. Either way, thank you for getting this started months before I could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Upgrading apps must change something. Call it out in the release notes bump: major Size of the change: breaking, ships only in a major release comp: analytics Google Analytics (src/analytics). comp: build/pipeline Build, bundling, packaging, release pipeline. type: feature New capability or enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Angular 22

3 participants