Repository navigation
Description
Problem
Apps that use @defer and incremental hydration (hydrate on viewport, hydrate never, ...) cannot see which blocks are on their placeholder, loading, complete or failed. They also cannot see which triggers a block waits for, or which blocks are still dehydrated. Today the only defer data is a page-wide count, deferBlocksWithIncrementalHydration (packages/ng-devtools/src/types.ts:230, read in packages/ng-devtools/src/http-overlay.ts:55, shown at app/src/pages/network-inspector.ts:431). The component tree lists components only (packages/ng-devtools/src/component-tree.ts:11-22, :226).
Angular already publishes this data in dev mode. ng.ɵgetControlFlowBlocks(node) (@angular/core 22.1.7, fesm2022/_debug_node-chunk.mjs:12565, implementation at :11739) returns these fields for each defer block: state, incrementalHydrationState, triggers, hasErrorBlock, loading and placeholder timing, hostNode and rootNodes. It also returns @for blocks with trackExpression. The profiler also emits DeferBlockStateStart and DeferBlockStateEnd. On Angular 20 the util is named ɵgetDeferBlocks. The package supports @angular/core >=20.
Neither demo app has a @defer block. The Travel app does not enable withIncrementalHydration() (src/app/app.config.ts:12).
Docs: https://angular.dev/guide/templates/defer and https://angular.dev/guide/incremental-hydration
Proposed scope
- Overlay: feature-detect
ɵgetControlFlowBlocks(orɵgetDeferBlocks), collect defer blocks for each component host, and refresh on change detection. Record when a block moves fromdehydratedtohydrated. - Panel: show blocks as child rows in the Components tree (or as a Hydration list in SSR & HTTP) with their state, triggers and hydration state. Highlight root nodes on hover. Flag
hydrate neversubtrees. - MCP: add a read tool (for example
ng-devtools:defer-blocks) that lists blocks and flags ones stuck in placeholder or error. - Demo: add a
/examples/deferpage with incremental hydration on. It should haveon viewport,on interaction,when,@loadingand@errorblocks, plushydrate on interactionandhydrate neverblocks. - Hide the section when the util is missing.
- Follow-up:
@fortrack expressions, and a source scan of defer triggers for the CLI.
Activity