Skip to content
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

Root component can't do streaming SSR #51956

Closed
SteveSandersonMS opened this issue Nov 9, 2023 · 4 comments
Closed

Root component can't do streaming SSR #51956

SteveSandersonMS opened this issue Nov 9, 2023 · 4 comments
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-streaming-rendering Pillar: Complete Blazor Web Priority:1 Work that is critical for the release, but we could probably ship without

Comments

@SteveSandersonMS
Copy link
Member

If you try to use @attribute [StreamRendering] on your root component, e.g.:

@attribute [StreamRendering]
<!DOCTYPE html>
<html lang="en">
<body>
    <App />
    <script src="_framework/blazor.web.js"></script>
</body>
</html>
@code {
    protected override async Task OnInitializedAsync()
    {
        await Task.Delay(1000);
    }
}

... you'll get a client-side error like this:

Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': Nodes of type '#text' may not be inserted inside nodes of type '#document'.

Looks like this should be possible to fix in the TypeScript code. Even though it would be very unusual to do this, I can't think of any reason why it should be disallowed.

If for some reason it turns out to be impractical to support the root component doing streaming SSR, we should at least have a better error message explaining why.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 9, 2023
@javiercn
Copy link
Member

javiercn commented Nov 9, 2023

@SteveSandersonMS didn't this came up at the time?

@SteveSandersonMS
Copy link
Member Author

@javiercn You might be thinking of "root component can't be interactive" which is slightly different.

@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. Pillar: Complete Blazor Web feature-blazor-streaming-rendering labels Nov 9, 2023
@mkArtakMSFT mkArtakMSFT added this to the Planning: WebUI milestone Nov 9, 2023
@ghost
Copy link

ghost commented Dec 20, 2023

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT mkArtakMSFT added the Priority:1 Work that is critical for the release, but we could probably ship without label Jan 11, 2024
@javiercn
Copy link
Member

We think we shouldn't be doing this as it would require a lot of special casing to make sure we avoid things like rendering scripts twice and so on.

We think it's fine for the root component to render in a non-streaming way as it usually contains the document "frame" for the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-streaming-rendering Pillar: Complete Blazor Web Priority:1 Work that is critical for the release, but we could probably ship without
Projects
None yet
Development

No branches or pull requests

3 participants