dotnet / dotnet/aspnetcore

PageTitle doesn't display for SSR pages in mixed render mode app

Open
#50,268 15 comments 0 reactions 0 assignees View on GitHub
area-blazor enhancement Pillar: Complete Blazor Web
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

**Info:** Investigation shows that this is related to enhanced navigation and DOM preservation. See comment.

I have a Blazor Server app with mixed render modes, SSR and WebAssembly (Auto). Some pages are server-rendered, and a couple of them have dynamic components (WebAssembly Auto) that set the title depending on content.

In ``App.razor``, I have added render mode to the ``HeadOutlet``:

```razor

```

Upon navigating to to a page, ``PageTitle`` is then only updated/rendered for the pages with dynamic components setting them, but not the server-side rendered pages.

They instead default to their address:

Screenshot 2023-08-22 at 20 26 52

The `````` element is not even rendered in ``<head></head>``.

### Expected Behavior

That PageTitle works in components of all modes a in mixed render mode app.

Even if ``HeadOutlet`` has the ``@rendermode="@RenderMode.Auto"`` the ``PageTitle``of SSR pages should be rendered.

### Steps To Reproduce

1. Create a Blazor Server app.
2. Update ``App.razor``:
```razor
<HeadOutlet @rendermode="@RenderMode.Auto" />
```

3. Create a page component which has a dynamic component that declares a ``PageTitle``.

### Exceptions (if any)

_No response_

### .NET Version

8.0.100-rc.2.23421.3

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.