-
-
Notifications
You must be signed in to change notification settings - Fork 348
feat: 源生成重写添加SetParametersAsync方法 #6235
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for your PR, @kimdiego2098. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Reviewer's GuideIntroduce a source-generator-based override for SetParametersAsync on key components to reduce reflection/caching overhead by applying the GenerateSetParametersAsync attribute and updating the project to include the generator. Sequence Diagram: Overridden SetParametersAsync Execution FlowsequenceDiagram
participant BlazorRuntime as "Blazor Runtime"
participant ComponentInstance as "Component (e.g., Checkbox)"
participant GeneratedCode as "Source-Generated SetParametersAsync()"
BlazorRuntime->>ComponentInstance: SetParametersAsync(parameters)
activate ComponentInstance
ComponentInstance->>GeneratedCode: Invokes (replaces default Blazor behavior)
activate GeneratedCode
GeneratedCode-->>ComponentInstance: Efficiently processes parameters
deactivate GeneratedCode
ComponentInstance-->>BlazorRuntime: Task completed
deactivate ComponentInstance
Class Diagram: Component Updates for Source-Generated SetParametersAsyncclassDiagram
class Checkbox~TValue~ {
+ [BlazorSetParametersAsyncGenerator.GenerateSetParametersAsync]
+ SetParametersAsync(ParameterView parameters) Task
}
class Radio~TValue~ {
+ [BlazorSetParametersAsyncGenerator.GenerateSetParametersAsync]
+ SetParametersAsync(ParameterView parameters) Task
}
Radio --|> Checkbox~TValue~
class Table~TItem~ {
+ [BlazorSetParametersAsyncGenerator.GenerateSetParametersAsync]
+ SetParametersAsync(ParameterView parameters) Task
}
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @kimdiego2098 - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
重写SetParametersAsync,原生SetParametersAsync方法使用大量缓存,属性多并且属于泛型组件的话,,WriterForType的缓存占用比较高,参考 dotnet/aspnetcore#44693
Summary by Sourcery
Introduce source-generated SetParametersAsync to optimize generic component parameter handling and reduce caching overhead
New Features:
Build: