Skip to content

Investigate not requiring unintuitive requirements for pre-rendering PageTitle #38400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pranavkm opened this issue Nov 15, 2021 · 1 comment · Fixed by #40512
Closed

Investigate not requiring unintuitive requirements for pre-rendering PageTitle #38400

pranavkm opened this issue Nov 15, 2021 · 1 comment · Fixed by #40512
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-prerendering Issues related to prerendering blazor components Priority:1 Work that is critical for the release, but we could probably ship without

Comments

@pranavkm
Copy link
Contributor

Pre-rendering for PageTitle requires rendering things in a specific order and relies on a _Layout.cshtml which is not very intuitive. See https://docs.microsoft.com/en-us/aspnet/core/blazor/components/prerendering-and-integration?view=aspnetcore-6.0&pivots=webassembly#prerendering-configuration for all of the steps involved here.

Possible things to look at:

a) Can we do away with requiring a separate _Layout?
b) If the first option is difficult, could we produce an error if the PageTitle component is being rendered before any other component?

@pranavkm pranavkm added the area-blazor Includes: Blazor, Razor Components label Nov 15, 2021
@TanayParikh TanayParikh added the feature-prerendering Issues related to prerendering blazor components label Nov 15, 2021
@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Nov 16, 2021
@mkArtakMSFT mkArtakMSFT added this to the .NET 7 Planning milestone Nov 16, 2021
@mkArtakMSFT mkArtakMSFT added the Priority:1 Work that is critical for the release, but we could probably ship without label Nov 16, 2021
@mkArtakMSFT
Copy link
Contributor

Marking as P1 for investigation to understand what the solution will look like. Depending on the findings we can reevaluate and see whether it's still P1 or not.

pranavkm added a commit that referenced this issue Mar 3, 2022
…0512)

Prior to this change HtmlRenderer would return a snapshot of a component immediately after it was initially rendered. This meant any updates to a component as a result of other root components rendering were lost. 

In this change, we update the HtmlRenderer to return a placeholder `IHtmlContent` that retrieves render frames only when `WriteTo` is invoked. Typically MVC will defer calling WriteTo until the content is about to be sent to the wire, which means any updates to a component (e.g. HeadOutlet being updated) are picked up.

Also updates the template to consolidate `_Host` and `_Layout`.

Fixes #38400
@ghost ghost locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-prerendering Issues related to prerendering blazor components Priority:1 Work that is critical for the release, but we could probably ship without
Projects
None yet
3 participants