Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

withIncrementalHydration - component can cleanup styles if there are still hydrate never usages #61271

Copy link
Copy link
Closed
@sod

Description

@sod
Issue body actions

Run the reproduction (https://github.com/sod/issue-ssr-reproduction-hydrate-never) via ng serve --no-hmr and scroll down. See how angular removes the .invert css block when you reach the end of the page.

CleanShot.2025-05-12.at.11.24.57.mp4

The reproduction looks roughly like this:

@for (item of items; track $index) { <!-- print this 30 times -->
  @defer (hydrate on viewport) { <!-- hydrate everything inside on viewport one-by-one -->
    <app-on-viewport style="display:block; padding:50px"></app-on-viewport>
    @defer (hydrate never) { <!-- but keep this static -->
      <app-hydrate-never></app-hydrate-never>
    }
  }
}

@defer (hydrate on viewport) {
  <!-- enabled$ = timer(1).pipe(map(() => false), startWith(true)) // so show, then remove again -->
  @if (enabled$ | async) { <!-- when this switches to falsy, the styles of `app-hydrate-never` are removed, even though they are still in use
    <app-hydrate-never></app-hydrate-never>
  }
}

seems to work fine with zone.js

Please provide the environment you discovered this bug in (run ng version)

latest 19 & 20

Angular CLI: 20.0.0-rc.0
Node: 22.15.0
Package Manager: yarn 1.22.22
OS: darwin arm64

Angular: 20.0.0-rc.0
... build, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router, ssr

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2000.0-rc.0
@angular-devkit/core         20.0.0-rc.0
@angular-devkit/schematics   20.0.0-rc.0
@schematics/angular          20.0.0-rc.0
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.