Skip to content

[BUG]: Using Zone.current.scheduleMacroTask doesn't delay serialization during SSR in v16 #50414

@brandonroberts

Description

@brandonroberts

Which @angular/* package(s) are the source of the bug?

platform-server, zone.js

Is this a regression?

Yes

Description

When using SSR/platform-server APIS to prerender pages, you can use the Zone.current.scheduleMacroTask() method to trigger the app to be "unstable" until its promise is resolved.

In v16, using the method call doesn't delay rendering to a string until the provided promise is resolved.

Steps to reproduce:

  1. Clone v16 repo provided below
  2. Run npm install on the project
  3. Run ng build
  4. Notice the destroy text logged to the console with no other text logged

https://github.com/brandonroberts/analog-angular-v16-prerender

The component that does the logging
https://github.com/brandonroberts/analog-angular-v16-prerender/blob/main/src/app/pages/for.%5Bme%5D.page.ts

Steps reproduce v15 working example

  1. Clone v15 repo provided below
  2. Run npm install on the project
  3. Run ng build
  4. Notice the object text logged to the console
{
  filename: '/src/content/pages/me.md',
  slug: 'me',
  attributes: {},
  content: '## About Me'
}
  1. Notice the destroy text logged to the console

https://github.com/brandonroberts/analog-angular-v15-prerender

  • Tried downgrading zone.js to 0.12.x with no changes in behavior
  • Tried removing provideClientHydration() with no changes in behavior

Please provide a link to a minimal reproduction of the bug

https://github.com/brandonroberts/analog-angular-v16-prerender

Please provide the exception or error you saw

No exceptions thrown

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

Angular CLI: 16.0.2
Node: 18.13.0
Package Manager: npm 8.19.3
OS: darwin arm64

Angular: 16.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.2
@angular-devkit/build-angular   16.0.2
@angular-devkit/core            16.0.2
@angular-devkit/schematics      16.0.2
@schematics/angular             16.0.2
rxjs                            7.5.7
typescript                      5.0.4

Anything else?

This project is using Analog but standard Angular APIs are used for SSR/routing/components.

Metadata

Metadata

Assignees

Labels

area: coreIssues related to the framework runtimearea: serverIssues related to server-side renderingarea: zonesIssues related to zone.jsregressionIndicates than the issue relates to something that worked in a previous version

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions