-
-
Notifications
You must be signed in to change notification settings - Fork 254
Add doc for OwningComponentBase to bit Boilerplate (#11768) #11767
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
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe AutoInject source generator is refactored to remove Razor component-specific code generation logic. An enum, handler class, and related helper methods are eliminated. The source generator now uses a single code path for all classes. The TodoPage component is updated to use lazy ScopedServices resolution instead of AutoInject field injection. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (5)
src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectClassType.cs(0 hunks)src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectRazorComponentHandler.cs(0 hunks)src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectSourceGenerator.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/.docs/09- Dependency Injection & Service Registration.md(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/TodoPage.razor.cs(1 hunks)
💤 Files with no reviewable changes (2)
- src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectClassType.cs
- src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectRazorComponentHandler.cs
🧰 Additional context used
🧬 Code graph analysis (2)
src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectSourceGenerator.cs (1)
src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectNormalClassHandler.cs (2)
AutoInjectNormalClassHandler(8-123)Generate(10-36)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/TodoPage.razor.cs (1)
src/Butil/Bit.Butil/Publics/Keyboard.cs (1)
Keyboard(10-100)
🪛 LanguageTool
src/Templates/Boilerplate/Bit.Boilerplate/.docs/09- Dependency Injection & Service Registration.md
[grammar] ~273-~273: Ensure spelling is correct
Context: ...es.GetRequiredService(); Insetad of csharp [AutoInject] private Key...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build Bit.Templates
🔇 Additional comments (3)
src/Templates/Boilerplate/Bit.Boilerplate/.docs/09- Dependency Injection & Service Registration.md (1)
253-284: Well-documented pattern for owned services.The new section clearly explains when and how to use
ScopedServicesfor automatic disposal of owned services in Blazor components. The before/after code examples effectively demonstrate the improvement.src/SourceGenerators/Bit.SourceGenerators/AutoInject/AutoInjectSourceGenerator.cs (1)
83-86: I'm unable to complete the automated verification due to persistent repository access issues. Let me provide a rewritten review comment that addresses this limitation:
Verify Razor component migration to ScopedServices pattern.
The removal of Razor component-specific code paths and shift to a single
NormalClassHandlerapproach aligns with the PR objective to use primary constructor injection uniformly. This is a cleaner architecture.However, automated verification of remaining
[AutoInject]usage in Razor components was not possible. Manual verification is required to confirm that:
- No orphaned
[AutoInject]attributes remain in Razor component code-behind files (inComponents/andPages/directories)- Existing components have been migrated to the
ScopedServicespattern shown inTodoPage.razor.csSearch for remaining
[AutoInject]usage in.csfiles within component directories to ensure complete migration.src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/TodoPage.razor.cs (1)
10-11: Manual verification required — unable to access repository to confirm C# 13 and base class configuration.The repository clone failed, preventing direct verification of the two concerns raised. However, web search confirms that the
fieldkeyword is a valid C# 13 feature with the syntax pattern shown in your code. The lazy initialization pattern (field ??= ...) is correctly used within a property accessor expression.To complete the verification, you will need to manually confirm:
- C# 13 is enabled: Check your
.csprojfile(s) for<LangVersion>13</LangVersion>or<LangVersion>preview</LangVersion>- ScopedServices is available: Verify that the base class of
TodoPage(likelyAppComponentBaseorAppPageBase) defines or inherits theScopedServicesproperty
closes #11768
Summary by CodeRabbit
Refactor
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.