dotnet / dotnet/aspnetcore

SectionContent doesn't work correctly with render modes

Open
#51,132 12 comments 2 reactions 0 assignees View on GitHub
area-blazor bug Pillar: Complete Blazor Web Priority:1
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

`SectionContent` doesn't inherit render mode (`SectionOutlet` does instead).

### Expected Behavior

`SectionContent` should inherit render mode

### Steps To Reproduce

In interactive server app add in top-row div in `MainLayout.razor`
```razor

```

In `Counter.razor` add
```razor

Click me

```

The result is that the button in the topbar does not increase the counter.

The workaround is to add interactive server mode to `SectionOutlet`:
```razor

```

Then the button is interctive.

However, if the app uses all render modes the bahavior is ugly.

If I have `ServerCounter.razor`, `AutoCounter.razor`, `WasmCounter.razor` (same `Counter.razor` but with the corresponding render mode) then there is a problem even with the workaround.

In case
```razor

```

https://github.com/dotnet/aspnetcore/assets/114938397/ca0c3976-06c7-47e1-8847-62085c821e50

Changing to interactive Auto is also bad

https://github.com/dotnet/aspnetcore/assets/114938397/6ef13ce4-7493-46c3-8308-38c0b41fc44a

### Exceptions (if any)

_No response_

### .NET Version

_No response_

### 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.