liveBook · Manning

ExperimentalPendingTasks

As explained in Modern Angular

ExperimentalPendingTasks is an Angular injectable that lets application code register pending asynchronous work before server-side rendering serialization completes.

ExperimentalPendingTasks is an Angular injectable for delaying server-side rendering serialization while zoneless applications complete asynchronous work. section 10.3.5

Use it when Angular cannot infer that asynchronous work must finish before serialization:

  • Inject ExperimentalPendingTasks and call add() to register pending work. section 10.3.5
  • Await the asynchronous operation, such as credential refresh followed by navigation. section 10.3.5
  • Call the returned cleanup function so Angular can continue serialization. section 10.3.5
const tasks = inject(ExperimentalPendingTasks);
const cleanup = tasks.add();
await someAsyncTask();
cleanup();

The compact listing shows the registration, awaited operation, and cleanup sequence. section 10.3.5

How Modern Angular covers it

How deep it goes
Defines registration and cleanup around asynchronous work, while cautioning against rushing the experimental approach into production.
Examples
Uses credential refresh followed by dashboard navigation as the motivating asynchronous SSR example.
What it assumes
Assumes familiarity with Angular SSR, zoneless change detection, dependency injection, and asynchronous tasks.
What you can do after
Apply it via Angular injection to register pending work, await it, and release serialization afterward.
How it connects
Connects zoneless change detection, server-side rendering, Zone.js, asynchronous tasks, and navigation redirects.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.