Skip to content

DefaultServerRenderer2 does not correctly implement selectRootElement #47844

@matthew-a-thomas

Description

@matthew-a-thomas

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

platform-server

Is this a regression?

No

Description

https://angular.io/api/core/Renderer2#selectrootelement says there is a preserveContext: boolean parameter. But DefaultServerRenderer2.selectRootElement has a different parameter instead.

This means that Renderer2.selectRootElement behaves differently on different platforms, which negatively affects prerendering/SSR among other things. Specifically, it's impossible to do anything but clear the selected element when rendering on the server.

Please provide a link to a minimal reproduction of the bug

selectRootElement(selectorOrNode: string|any, debugInfo?: any): any {

Please provide the exception or error you saw

No response

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

Angular CLI: 14.2.6
Node: 16.17.1
Package Manager: yarn 1.22.19
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.6
@angular-devkit/build-angular   14.2.6
@angular-devkit/core            14.2.6
@angular-devkit/schematics      12.2.18
@angular/cdk                    14.2.5
@angular/cli                    14.2.6
@angular/material               14.2.5
@nguniversal/builders           14.2.0
@nguniversal/express-engine     14.2.0
@schematics/angular             14.2.6
rxjs                            6.6.7
typescript                      4.7.4
webpack                         5.74.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions