[Blazor] Unify root components initialization paths.
- 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
Assessment
This issue has not been assessed yet.