-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(Layout): add OnTabHeaderTextLocalizer parameter #7070
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
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR introduces a new callback parameter for localizing tab header text in the Layout component and refactors how the Tab component manages its AdditionalAssemblies defaulting, removing the NotNull constraint and inline initialization in favor of a centralized helper. Class diagram for new OnTabHeaderTextLocalizer parameter in Layout componentclassDiagram
class Layout {
+bool IsSmallScreen
+Func<string?, string?>? OnTabHeaderTextLocalizer
+TabStyle TabStyle
}
class Tab {
+IEnumerable<Assembly>? AdditionalAssemblies
+void AddTab(string url, string text, string? icon = null, bool active = true)
-static List<Assembly> GetAdditionalAssemblies()
}
Layout --> Tab : uses
Class diagram for refactored AdditionalAssemblies handling in Tab componentclassDiagram
class Tab {
+IEnumerable<Assembly>? AdditionalAssemblies
-static List<Assembly> GetAdditionalAssemblies()
}
File-Level Changes
Assessment against linked issues
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 there - I've reviewed your changes - here's some feedback:
- Consider handling the case where Assembly.GetEntryAssembly returns null in GetAdditionalAssemblies to avoid potential NullReferenceExceptions.
- It might be more reliable to initialize AdditionalAssemblies in OnInitialized or OnParametersSet rather than lazily in AddTabItem to ensure consistent behavior across all methods.
- You may want to provide a default identity function for OnTabHeaderTextLocalizer so child components don’t have to perform null checks before localizing tab header text.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider handling the case where Assembly.GetEntryAssembly returns null in GetAdditionalAssemblies to avoid potential NullReferenceExceptions.
- It might be more reliable to initialize AdditionalAssemblies in OnInitialized or OnParametersSet rather than lazily in AddTabItem to ensure consistent behavior across all methods.
- You may want to provide a default identity function for OnTabHeaderTextLocalizer so child components don’t have to perform null checks before localizing tab header text.
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/Components/Tab/Tab.razor.cs:807` </location>
<code_context>
StateHasChanged();
}
+ private static List<Assembly> GetAdditionalAssemblies() => [Assembly.GetEntryAssembly()!];
+
private void AddTabItem(string url)
</code_context>
<issue_to_address>
**issue:** GetAdditionalAssemblies assumes Assembly.GetEntryAssembly is non-null.
Consider handling the case where Assembly.GetEntryAssembly() returns null to prevent possible runtime exceptions in environments without an entry assembly.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7070 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 745 745
Lines 32562 32556 -6
Branches 4513 4512 -1
=========================================
- Hits 32562 32556 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR refactors the Tab component's AdditionalAssemblies initialization logic and exposes the OnTabHeaderTextLocalizer parameter through the Layout component. The changes move from eager initialization in OnParametersSet to lazy initialization when needed, and propagate tab header text localization support to the Layout level.
- Refactored
AdditionalAssembliesinitialization from eager to lazy loading pattern - Added
OnTabHeaderTextLocalizerparameter to Layout component for tab header text localization - Bumped version numbers for both beta and RC releases
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/BootstrapBlazor/Components/Tab/Tab.razor.cs | Removed [NotNull] attribute and eager initialization logic for AdditionalAssemblies, replaced with lazy initialization via new GetAdditionalAssemblies() method |
| src/BootstrapBlazor/Components/Layout/Layout.razor.cs | Added OnTabHeaderTextLocalizer parameter to enable tab header text localization at the Layout level |
| src/BootstrapBlazor/Components/Layout/Layout.razor | Passed OnTabHeaderTextLocalizer parameter from Layout to Tab component |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Incremented version numbers for beta (9.12.2-beta02 → beta03) and RC (10.0.0-rc.2.2.4 → rc.2.2.5) releases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Link issues
fixes #7069
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add OnTabHeaderTextLocalizer callback to Layout for customizable tab header text and refactor AdditionalAssemblies initialization in Tab component
New Features:
Enhancements: