Repository navigation
feat(app): add initializeBrowserOrServerApp for browser & server apps (21.1.x) - #3848
Open
armando-navarro wants to merge 2 commits into
Open
armando-navarro wants to merge 2 commits into
armando-navarro wants to merge 2 commits into
Conversation
…#3827) ɵzoneWrap holds a pending task from the moment a wrapped call gets a callback until that callback first runs. For onLog, onTokenChanged, the Database child listeners (onChildAdded on an empty node, the other three until a later change), off, enableLogging, and the rxfire streams stateChanges and auditTrail, nothing guarantees that first run, so ApplicationRef.isStable can stay false for good and an SSR build's route extraction times out, as angular#3748 reported for beforeAuthStateChanged. They keep logLevel WARN, so only the pending task changes. isSupported in remote-config is the twelfth: angular#3613 put its blockUntilFirst: false entry in the rxfire block, which exports no isSupported, so it never applied, and angular#3759 removed the dead entry. Server renders no longer wait for onChildAdded's first batch (onValue, object and list still wait), and off(ref, type, cb) still detaches nothing, because the wrapper replaces the callback it is given. fromRef takes the event to listen for, and one blockUntilFirst value cannot fit both uses: value always fires on attach, while a child event may never fire. A hand-written fromRef in overrides.ts wraps rxfire's fromRef both ways and picks by event, so fromRef(ref, ListenEvent.value) holds a server render like object(ref) and child events do not. Fixes angular#3826 (cherry picked from commit c593ecd)
…angular#3844) * feat(app): add initializeBrowserOrServerApp for browser & server apps One call inside provideFirebaseApp that returns the ordinary app in the browser and, on the server, a FirebaseServerApp for the visitor's ID token and App Check token, read from REQUEST_CONTEXT or passed in the settings. With neither token it returns the ordinary app. The server app is released when the render is garbage collected, as the releaseOnDeref setup in the guide does. releaseAfterRender opts into a release at render end or a fixed time after it. A token Firebase cannot parse now renders signed out with one warning instead of an HTTP 500. In dev mode a request with no request context is noted once. The App Check server warning now says which renders send no token. The Node specs can import the built library through a resolve hook. Fixes angular#3843 * fix(app): keep the default release working when an ngOnDestroy throws The object handed to the SDK as releaseOnDeref was kept alive by a DestroyRef.onDestroy closure. R3Injector.destroy runs every service's ngOnDestroy before it empties those closures, so a throw there left the object reachable from the injector, and any listener that kept the injector alive kept the server app alive with it. The object is now a providedIn: 'root' service, which the finally of destroy drops whatever threw before it. The timed mode still releases from DestroyRef.onDestroy and a throw before it still skips that release, as the docs say. New specs on the release path: the default release observed through forced collections, a shared app with a positive releaseAfterRender released once per render, a null JSON payload, the App Check half of the token comparison, and a throwing ngOnDestroy next to a retained injector reference. The test:node scripts pass --expose-gc for the forced collections. The resolve hook picks the exports entry the way Node does, the first key in the map's order that is an active condition or default. Refs angular#3844 (cherry picked from commit 74abd5a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #3843
Refs #3826
Cherry-picks of #3827 (
c593ecdonmain) and #3844 (74abd5aonmain) onto21.1.x, so both ship in 21.1.0. #3827 comes first because #3844's spec files build on it. Both apply with no conflicts in that order.On this branch: build and lint clean,
test:node420 specs with 0 failures on Node 20 and Node 22, and the Chrome headless suite green.