Skip to content

Root component can't do streaming SSRΒ #51956

@SteveSandersonMS

Description

@SteveSandersonMS

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions