Skip to content

Inspect @defer blocks and incremental hydration state with ng.ɵgetControlFlowBlocks #116

Closed

Description

@erkamyaman

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 from dehydrated to hydrated.
  • 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 never subtrees.
  • 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/defer page with incremental hydration on. It should have on viewport, on interaction, when, @loading and @error blocks, plus hydrate on interaction and hydrate never blocks.
  • Hide the section when the util is missing.
  • Follow-up: @for track expressions, and a source scan of defer triggers for the CLI.

Activity

  1. added
    feature
    P2
    needs triage
    area: package
    on Sep 30, 2026
  2. self-assigned this
    on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2area: packagefeatureneeds triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions