dotnet / dotnet/aspnetcore

[Blazor] Unify root components initialization paths.

Open
#64,508 2 comments 0 reactions 0 assignees View on GitHub
area-blazor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

When we initialize components (specially in Blazor Server) we have since 8.0 three different ways in which components get initialized.

* First through `ComponentHub.Start` for old `blazor.server.js`.
* Second through `UpdateRootComponents` by `blazor.web.js`.
* Third through JS Root components via `CircuitJSComponentInterop.cs`.

This is problematic because it creates slight variations of our initialization logic that manifest themselves in bugs that are hard to track.

We should consider standarizing on `UpdateRootComponents` since that's the model Blazor Web uses. This would involve:
* Update `blazor.server.js` to go through UpdateRootComponents (same as blazor.web.js).
* This would mean we could get rid of the old `blazor.server.js` initialization code, as it would be handled by `blazor.web.js`.
* Update JS root components to also go through `UpdateRootComponents`.
* We would get rid of the JS interop associated with this functionality as it would be subsumed by UpdateRootComponents.
* We would likely require expanding the RootComponentDescriptors to accept creating components with "client descriptors" which would be subject to the same restrictions JS Root Components have today.

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.