René's URL Explorer Experiment


Title: feat(app): add initializeBrowserOrServerApp for browser & server apps by armando-navarro · Pull Request #3844 · angular/angularfire · GitHub

Open Graph Title: feat(app): add initializeBrowserOrServerApp for browser & server apps by armando-navarro · Pull Request #3844 · angular/angularfire

X Title: feat(app): add initializeBrowserOrServerApp for browser & server apps by armando-navarro · Pull Request #3844 · angular/angularfire

Description: Fixes #3843 Docs included?: no. The docs/auth.md, docs/app-check.md and docs/version-22-upgrade.md changes go on the rc.1 docs pull request, #3835, which merges just before the tag. Test units included?: yes. New Node specs in src/app/browser-or-server-app.jasmine.ts. A browser spec in src/app/app.spec.ts and two in src/app-check/app-check.spec.ts. Breaking change?: no. Nothing calls the new function until an app opts in. The App Check server warning's text changes. In a clean directory, yarn install, yarn test run successfully? yes, with npm: npm ci, npm run build, npm run lint, npm run test:node on Node 22, 24 and 26, and npm run test:chrome-headless. Description This adds initializeBrowserOrServerApp to @angular/fire/app, one call inside provideFirebaseApp that returns the ordinary app in the browser and a FirebaseServerApp for the visitor's tokens on the server. It replaces the callback the Authentication guide asks server-rendered apps to write. The reasoning is in the linked issue. Changes src/app/browser-or-server-app.ts, exported from @angular/fire/app: initializeBrowserOrServerApp(options, settings?). On the server it reads authIdToken and appCheckToken from REQUEST_CONTEXT, or from settings when passed there, and builds a server app when either is present. By default the server app is released when the render is garbage collected, the way releaseOnDeref works, so a repeat request from the same visitor reuses it. settings.releaseAfterRender opts into a release at render end (0) or that many milliseconds after it. On a runtime without FinalizationRegistry the release is at render end. releaseOnDeref is typed never, and stripped at runtime, so one server app is never released twice. A token the SDK cannot parse (its own check throws a SyntaxError or TypeError) returns the ordinary app after one fixed warning per process, then one line per hundred. Every FirebaseError still propagates. In dev mode, a request with no request context is noted once per process. When the server app the SDK returns does not carry the tokens asked for, the ordinary app is returned instead. src/app-check/app-check.module.ts: the dev-mode server warning now says that server renders without a relayed App Check token send none, and points at the new function. src/app/app.ts: the comment's usage example no longer shows deleteApp on the injected app. tools/angular-fire-resolve-hook.mjs and tools/jasmine-register-angular-fire.mjs, preloaded by test:node and test:node-esm: a resolve hook that maps @angular/fire imports to the built library, so Node specs can import it. No Node spec could before. Behavior to know The function always builds the default app. Keep exactly one provideFirebaseApp and pass inject(FirebaseApp) to every product provider, as the guide says. Never call deleteApp on the injected app when using the function. It releases the server app itself. A fresh server app costs about 300 to 400 ms (a Firestore connection and an account lookup). With the default release a repeat request for the same visitor is as fast as a signed-out one. With releaseAfterRender: 0 every repeat request pays that cost again, which the docs state. With releaseAfterRender set, the release is a DestroyRef.onDestroy callback. An ngOnDestroy method or an ApplicationRef.onDestroy listener that throws keeps it from running, and that render's server app stays behind. The default release does not run during that destroy and is not affected. Verified outside CI On a fresh Angular 22 app wired by following the rewritten guide literally, against a real project: 24 concurrent signed-in renders with distinct tokens, and 24 sharing one token, in each release mode: every page rendered signed in with its Firestore data, and the server-app count returned to zero (after a forced collection in the default mode, without one with releaseAfterRender: 0, after about a second with 1000). Also under ng serve and in an NgModule-bootstrapped app. Unparseable, junk, expired and real stale cookies: HTTP 200 and a signed-out page every time, with the helper's warning only for the unparseable one. With App Check enforcement on for Firestore: a render with a relayed token reads Firestore, the same render without one is rejected, and an expired App Check token fails the read in 340 ms rather than hanging. The sample app's split app.config.client.ts and app.config.server.ts layout renders signed out and signed in. The production browser bundle is the same size with and without the function. A raw firebase/firestore read still pending when the app is released at render end resolves normally, and a client abort mid-render lets the render finish and release its app. Tyler, the part I'd most like a second look at is the release in buildServerApp: the default hands the SDK a root service (ɵRequestLifetime) that lives as long as the render's injector, and the timed mode releases from the injector's onDestroy.

Open Graph Description: Fixes #3843 Docs included?: no. The docs/auth.md, docs/app-check.md and docs/version-22-upgrade.md changes go on the rc.1 docs pull request, #3835, which merges just before the tag. Test units inc...

X Description: Fixes #3843 Docs included?: no. The docs/auth.md, docs/app-check.md and docs/version-22-upgrade.md changes go on the rc.1 docs pull request, #3835, which merges just before the tag. Test units inc...

Opengraph URL: https://github.com/angular/angularfire/pull/3844

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:cc45e387-8627-6465-9836-22e0d5ebe833
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9112:2264DD:8BCA5F:B2641F:6B036337
html-safe-nonceaf2f9abbe9bf64d533854af3786c4783a98cf972d9063a7d16ad29f580d336a1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTEyOjIyNjRERDo4QkNBNUY6QjI2NDFGOjZCMDM2MzM3IiwidmlzaXRvcl9pZCI6IjQ3OTkzMjk1MjkzMTc1MTYwODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacdaa9b117ceb04750e66624cb0b436573232eccd57cee525851cc6fc24139f147
hovercard-subject-tagpull_request:5249762944
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/angular/angularfire/pull/3844/files
twitter:imagehttps://avatars.githubusercontent.com/u/13904589?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/13904589?s=400&v=4
og:image:altFixes #3843 Docs included?: no. The docs/auth.md, docs/app-check.md and docs/version-22-upgrade.md changes go on the rc.1 docs pull request, #3835, which merges just before the tag. Test units inc...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/angular/angularfire git https://github.com/angular/angularfire.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id49453413
octolytics-dimension-repository_nwoangular/angularfire
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49453413
octolytics-dimension-repository_network_root_nwoangular/angularfire
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/angular/angularfire/pull/3844/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangularfire%2Fpull%2F3844%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangularfire%2Fpull%2F3844%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=angular%2Fangularfire
Reloadhttps://github.com/angular/angularfire/pull/3844/files
Reloadhttps://github.com/angular/angularfire/pull/3844/files
Reloadhttps://github.com/angular/angularfire/pull/3844/files
angularhttps://github.com/angular
angularfirehttps://github.com/angular/angularfire
Codehttps://github.com/angular/angularfire
Issues162 (162)https://github.com/angular/angularfire/issues
Pull requests5 (5)https://github.com/angular/angularfire/pulls
Discussionshttps://github.com/angular/angularfire/discussions
Actionshttps://github.com/angular/angularfire/actions
Projectshttps://github.com/angular/angularfire/projects
Security and qualityhttps://github.com/angular/angularfire/security
Insightshttps://github.com/angular/angularfire/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fangular%2Fangularfire%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fangular%2Fangularfire%2Fissues%2Fnew%2Fchoose
armando-navarrohttps://github.com/armando-navarro
angular:mainhttps://github.com/angular/angularfire/tree/main
armando-navarro:browser-or-server-apphttps://github.com/armando-navarro/angularfire/tree/browser-or-server-app
Conversation 13 https://github.com/angular/angularfire/pull/3844
Commits 3 https://github.com/angular/angularfire/pull/3844/commits
Checks 25 https://github.com/angular/angularfire/pull/3844/checks
Files changed https://github.com/angular/angularfire/pull/3844/files
Please reload this pagehttps://github.com/angular/angularfire/pull/3844/files
feat(app): add initializeBrowserOrServerApp for browser & server apps https://github.com/angular/angularfire/pull/3844/files#top
Show all changes 3 commits https://github.com/angular/angularfire/pull/3844/files
6799291 feat(app): add initializeBrowserOrServerApp for browser & server apps armando-navarro Nov 10, 2026 https://github.com/angular/angularfire/pull/3844/commits/6799291de728dfa88cbee09e6fc644ecf410d5ea
06e6744 Merge branch 'main' into browser-or-server-app armando-navarro Nov 10, 2026 https://github.com/angular/angularfire/pull/3844/commits/06e6744c9e1136aa3dd25acea7398ade9bc0e18e
ae887a0 fix(app): keep the default release working when an ngOnDestroy throws armando-navarro Nov 11, 2026 https://github.com/angular/angularfire/pull/3844/commits/ae887a041ca34274da9be4592bde65e139c8e12a
Clear filters https://github.com/angular/angularfire/pull/3844/files
Please reload this pagehttps://github.com/angular/angularfire/pull/3844/files
Please reload this pagehttps://github.com/angular/angularfire/pull/3844/files
package.json https://github.com/angular/angularfire/pull/3844/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
app-check.module.ts https://github.com/angular/angularfire/pull/3844/files#diff-a5f187a280bf2332af92cb764a9b817c1590db098c464246abe523029105e1ed
app-check.spec.ts https://github.com/angular/angularfire/pull/3844/files#diff-4bf71922e363cf1c41679843e711f61518e0062e23cc20f4610474dcd3ef0589
public_api.ts https://github.com/angular/angularfire/pull/3844/files#diff-7c7da5e685c63e8e03af7b2827c18b91a86c30a56e5257e85e1c2321a4921c54
app.spec.ts https://github.com/angular/angularfire/pull/3844/files#diff-bee3d094bd6c620b532afb37b445f544ec2304de87a35b9d818bd50da4230e42
app.ts https://github.com/angular/angularfire/pull/3844/files#diff-18f0b78b713daf3f4fc2d305926785508575bdc7f304363a64a3b3a2985b58be
browser-or-server-app.jasmine.ts https://github.com/angular/angularfire/pull/3844/files#diff-a5e9c0648f166bef52ea721c1b89d09379cdde5666e1dffa6b2789ff24f1eb67
browser-or-server-app.ts https://github.com/angular/angularfire/pull/3844/files#diff-bda53c115148f7c9a11ac5c60bd853d1ab2b9740aa34cbcfed0dcd6a1ff60f0e
public_api.ts https://github.com/angular/angularfire/pull/3844/files#diff-f6f60410c0bf63159a00bf32295ae8c0c74b388731f61048c8a2baad898442c9
angular-fire-resolve-hook.mjs https://github.com/angular/angularfire/pull/3844/files#diff-eda1b72081c05df2683e0c68707bf03f048e971f156d69ddbdac58a3147d236a
jasmine-register-angular-fire.mjs https://github.com/angular/angularfire/pull/3844/files#diff-596f739b091f9add77e731e4040b01dcd3ae07814c6ea8620e5e7befa9b6a0ef
package.jsonhttps://github.com/angular/angularfire/pull/3844/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
View file https://github.com/armando-navarro/angularfire/blob/ae887a041ca34274da9be4592bde65e139c8e12a/package.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angularfire/pull/3844/{{ revealButtonHref }}
https://github.com/angular/angularfire/pull/3844/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
https://github.com/angular/angularfire/pull/3844/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519
src/app-check/app-check.module.tshttps://github.com/angular/angularfire/pull/3844/files#diff-a5f187a280bf2332af92cb764a9b817c1590db098c464246abe523029105e1ed
View file https://github.com/armando-navarro/angularfire/blob/ae887a041ca34274da9be4592bde65e139c8e12a/src/app-check/app-check.module.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angularfire/pull/3844/{{ revealButtonHref }}
https://github.com/angular/angularfire/pull/3844/files#diff-a5f187a280bf2332af92cb764a9b817c1590db098c464246abe523029105e1ed
https://github.com/angular/angularfire/pull/3844/files#diff-a5f187a280bf2332af92cb764a9b817c1590db098c464246abe523029105e1ed
src/app-check/app-check.spec.tshttps://github.com/angular/angularfire/pull/3844/files#diff-4bf71922e363cf1c41679843e711f61518e0062e23cc20f4610474dcd3ef0589
View file https://github.com/armando-navarro/angularfire/blob/ae887a041ca34274da9be4592bde65e139c8e12a/src/app-check/app-check.spec.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angularfire/pull/3844/{{ revealButtonHref }}
https://github.com/angular/angularfire/pull/3844/files#diff-4bf71922e363cf1c41679843e711f61518e0062e23cc20f4610474dcd3ef0589
https://github.com/angular/angularfire/pull/3844/files#diff-4bf71922e363cf1c41679843e711f61518e0062e23cc20f4610474dcd3ef0589
https://github.com/angular/angularfire/pull/3844/files#diff-4bf71922e363cf1c41679843e711f61518e0062e23cc20f4610474dcd3ef0589
src/app-check/public_api.tshttps://github.com/angular/angularfire/pull/3844/files#diff-7c7da5e685c63e8e03af7b2827c18b91a86c30a56e5257e85e1c2321a4921c54
View file https://github.com/armando-navarro/angularfire/blob/ae887a041ca34274da9be4592bde65e139c8e12a/src/app-check/public_api.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angularfire/pull/3844/{{ revealButtonHref }}
src/app/app.spec.tshttps://github.com/angular/angularfire/pull/3844/files#diff-bee3d094bd6c620b532afb37b445f544ec2304de87a35b9d818bd50da4230e42
View file https://github.com/armando-navarro/angularfire/blob/ae887a041ca34274da9be4592bde65e139c8e12a/src/app/app.spec.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angularfire/pull/3844/{{ revealButtonHref }}
https://github.com/angular/angularfire/pull/3844/files#diff-bee3d094bd6c620b532afb37b445f544ec2304de87a35b9d818bd50da4230e42
https://github.com/angular/angularfire/pull/3844/files#diff-bee3d094bd6c620b532afb37b445f544ec2304de87a35b9d818bd50da4230e42
src/app/app.tshttps://github.com/angular/angularfire/pull/3844/files#diff-18f0b78b713daf3f4fc2d305926785508575bdc7f304363a64a3b3a2985b58be
View file https://github.com/armando-navarro/angularfire/blob/ae887a041ca34274da9be4592bde65e139c8e12a/src/app/app.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/angular/angularfire/pull/3844/{{ revealButtonHref }}
https://github.com/angular/angularfire/pull/3844/files#diff-18f0b78b713daf3f4fc2d305926785508575bdc7f304363a64a3b3a2985b58be
https://github.com/angular/angularfire/pull/3844/files#diff-18f0b78b713daf3f4fc2d305926785508575bdc7f304363a64a3b3a2985b58be
Please reload this pagehttps://github.com/angular/angularfire/pull/3844/files
Please reload this pagehttps://github.com/angular/angularfire/pull/3844/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.