Description
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
PendingTasks
class is very useful and I'd love it already to be in the stable API (no longer developer preview).
Usecase:
I'd like to inform Angular that it should wait for my specific custom tasks until Angular considers the app to be stable. It will help me to avoid Layout Shift because of too-early cleanup of dehydrated DOM.
In particular, while optimizing TBT Web Vital of my app, and when using RxFor
directive (from @rx-angular/template
library) to split long initial rendering (when CSR kicks in after getting SSR HTML) I experienced a problem - Angular considered the app as stable and removed parts of the DOM of the SSR HTML while RxFor
directive was still busy in rendering asynchronously sub-components in separate macro tasks (to optimize TBT).
For more see, the issue in rx-angular repo: rx-angular/rx-angular#1867
For the rx-angular
library to fix the issue, I believe they would like to use only a stable Angular API - PendingTasks
. But until it's in developer preview phase, it's risky to use this Angular API in their source code, becasue this API might change any time.
Proposed solution
Remove @developerPreview
marker from the source code and update documentation.
Alternatives considered
To my limited knowledge, there is no other workaround method to inform Angular that it should wait for my custom tasks until the app is considered stable. Perhaps I'm missing something obvious - then please let me know. :)