-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[Blazor] Update discovery APIs and automatically configure the endpoints based on the discovered RenderModes #48283
Conversation
src/Components/Endpoints/src/Builder/RazorComponentApplicationAttribute.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Builder/RazorComponentEndpointConventionBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSourceFactory.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/ComponentCollectionBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/PageCollectionBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/PageCollectionBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/PageCollectionBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/PageCollectionBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/RazorComponentApplication.cs
Outdated
Show resolved
Hide resolved
src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/ComponentLibraryBuilder.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/ComponentLibraryBuilder.cs
Outdated
Show resolved
Hide resolved
Can we open a discussion about the pros and cons of automatically wiring up websocket/wasm endpoints based on the existence of components with particular render modes? I know you've done a lot of work to enable that here, however developers still have to understand what's going on and could be at risk of misconfiguration. For example, the default setup would automatically switch on the WebSocket listener if someone adds an We could potentially simplify this a lot (remove a lot of implementation that would have to be maintained) and take a more risk-averse position on opening endpoints with only a tiny extra bit of explicit code in If the default project template was a bit more explicit: -app.MapRazorComponents<App>();
+app.MapRazorComponents<App>()
+ .EnableServerRenderMode()
+ .EnableWebAssemblyRenderMode(); ... then we could remove lots of the rules about how the endpoint registrations are detected and how you can override that via combinations of Again, I know it's painful to even have this discussion given the amount of code already written and how invested you may feel in the autodetection design. We could always add the autodetection in the future (e.g., Definitely also interested in opinions from others (cc @danroth27 @mkArtakMSFT) to try to stay objective about product goals. |
src/Components/Endpoints/src/Builder/RazorComponentEndpointDataSource.cs
Show resolved
Hide resolved
} | ||
|
||
return (pages, components); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be unit-tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't plan to. This is covered by our E2E tests and will be source generated by default. This is here as a fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the scenarios where someone would disable the source generator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there? I see the SG similar to the Razor SG. It's part of the core experience, not something you opt in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the source generator is available, we won't use this code path at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the source generator is available, we won't use this code path at all.
OK that's great - I'm guessing that means we'll be able to remove it and won't have to worry about maintaining two implementations. If that's not the case it would be great if you could correct me on this.
src/Components/Endpoints/src/Builder/RazorComponentEndpointConventionBuilder.cs
Outdated
Show resolved
Hide resolved
…s based on RenderMode
09eb756
to
28e9c61
Compare
src/Components/Endpoints/src/Discovery/AssemblyComponentLibraryDescriptor.cs
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/RazorComponentApplication.cs
Outdated
Show resolved
Hide resolved
src/Components/Endpoints/src/Discovery/RazorComponentApplication.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Added a couple of questions which it would be great if you could answer. The nitpick code remarks I'll leave to your judgement.
#46980