feat: 源生成重写添加SetParametersAsync方法#6235
Closed
kimdiego2098 wants to merge 2 commits intomainfrom
Closed
Conversation
|
Thanks for your PR, @kimdiego2098. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
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
|
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
重写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: