aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Content Section content not rendered on client if you turn off pre-rendering of the Interactive Server page

Open htmlsplash opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

Blazor, .net 8

Content that is placed inside a section is not rendered in the client if the user turns of pre-rendering on interactive server page.

@rendermode @(new InteractiveServerRenderMode(prerender: false))

<SectionContent SectionName="sidebar"> <Component1 @rendermode=InteractiveServer></Component1> </SectionContent>

Background: The section outlet for the section is located in the nav menu and inherits static SSR render mode. The content inside that section is a component that has an interactive server mode specified explicitly. Since the page is using interactive server mode and so is the component, the component should render regardless.

Link to test Repo: https://github.com/htmlsplash/BlazorWebAppTest

Select "Missing Content Test", the page will render but "component 1" is not rendered in the nav menu (its text is not displayed in the nav menu). That's because I have turned off pre-rendering on the page. To fix this issue, turn on pre-rendering and the component 1 text will render in the nav menu.

Expected Behavior

The interactive server component should render in the section on the client because it uses same interactive server mode as the page.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

.net 8

Anything else?

No response

htmlsplash avatar Aug 28 '24 15:08 htmlsplash

@htmlsplash thanks for contacting us.

This is by design. Content sections and their outlets need to render simultaneously on a given render mode to work.

For example, both need to run on the server using SSR for the output to be present on the prerendered output.

Or both need to render in a given interactive render mode (WebAssembly/Server) for the document to be updated once the specific runtime boots up.

We might in the future improve the experience by throwing an exception or a warning when detecting an incompatible set of configurations, but that's not something we do today.

javiercn avatar Aug 28 '24 15:08 javiercn

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.