Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jan 10, 2026

Link issues

fixes #7494

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Enhancements:

  • Replace concrete ErrorLogger usages with the IErrorLogger interface in Tab and Layout components and in the ErrorLogger initialization callback to align with the abstraction.

Copilot AI review requested due to automatic review settings January 10, 2026 12:50
@bb-auto bb-auto bot added the chore This are tasks or bot action label Jan 10, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 10, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Renames usages of the ErrorLogger component to use the IErrorLogger interface in consumer components and updates the ErrorLogger initialization callback to expose the interface type, aligning field types and callback signatures with the interface without altering behavior.

Class diagram for ErrorLogger to IErrorLogger usage update

classDiagram
    direction LR

    class IErrorLogger {
        <<interface>>
        Register(handlerException)
    }

    class ErrorLogger {
        +Func~IErrorLogger, Task~ OnInitializedCallback
    }

    class TabItemContent {
        -IOptionsMonitor~BootstrapBlazorOptions~ Options
        -IErrorLogger _logger
        -RenderHandle _renderHandle
        BuildRenderTree(builder)
    }

    class Layout {
        -IErrorLogger _errorLogger
        -Task OnErrorLoggerInitialized(logger)
    }

    ErrorLogger ..|> IErrorLogger

    TabItemContent --> IErrorLogger : uses_field
    TabItemContent --> ErrorLogger : uses_static_names

    Layout --> IErrorLogger : uses_field
    Layout --> IErrorLogger : init_callback_param

    ErrorLogger --> IErrorLogger : OnInitializedCallback_type
Loading

File-Level Changes

Change Details Files
Update TabItemContent to store and work with the error logger via the IErrorLogger interface rather than the concrete ErrorLogger type.
  • Change backing field type for the logger from the concrete component to the IErrorLogger interface.
  • Adjust the RenderTree builder attribute that passes an initialization callback so that the callback now accepts an IErrorLogger instance instead of ErrorLogger.
  • Keep usage of nameof(ErrorLogger.*) for attribute names so the rendered parameter names remain unchanged at runtime.
src/BootstrapBlazor/Components/Tab/TabItemContent.cs
Update Layout component to reference the error logger via the IErrorLogger interface.
  • Change the _errorLogger field type from ErrorLogger to IErrorLogger.
  • Update the OnErrorLoggerInitialized callback signature to accept IErrorLogger instead of ErrorLogger while preserving registration behavior.
src/BootstrapBlazor/Components/Layout/Layout.razor.cs
Expose the error logger initialization callback parameter as the IErrorLogger interface from within the ErrorLogger component.
  • Change the OnInitializedCallback component parameter type from Func<ErrorLogger, Task>? to Func<IErrorLogger, Task>? so callers receive the interface abstraction.
  • Leave the underlying ErrorLogger class implementation intact to maintain existing behavior while presenting the interface to consumers.
src/BootstrapBlazor/Components/ErrorLogger/ErrorLogger.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7494 Update consumer components to use IErrorLogger instead of ErrorLogger for stored references and initialization callbacks.
#7494 Change the ErrorLogger component's OnInitializedCallback parameter type to use IErrorLogger instead of ErrorLogger.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added this to the v10.2.0 milestone Jan 10, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang changed the title chore(ErrorLogger): rename ErrorLogger to IErrorLogger chore(ErrorLogger): replace concrete ErrorLogger usages with the IErrorLogger Jan 10, 2026
@ArgoZhang ArgoZhang merged commit 34fa2ca into main Jan 10, 2026
6 of 8 checks passed
@ArgoZhang ArgoZhang deleted the feat-error branch January 10, 2026 12:53
Copy link
Contributor

Copilot AI left a 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 codebase to use the IErrorLogger interface instead of the concrete ErrorLogger class for field declarations and callback signatures, promoting better abstraction and testability.

Changes:

  • Updated private field types from ErrorLogger? to IErrorLogger? in TabItemContent and Layout components
  • Updated callback function signatures from Func<ErrorLogger, Task> to Func<IErrorLogger, Task> in ErrorLogger component and its consumers

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/BootstrapBlazor/Components/Tab/TabItemContent.cs Changed private logger field and callback parameter types to use IErrorLogger interface
src/BootstrapBlazor/Components/Layout/Layout.razor.cs Changed private logger field and initialization method parameter to use IErrorLogger interface
src/BootstrapBlazor/Components/ErrorLogger/ErrorLogger.cs Changed OnInitializedCallback parameter type to accept IErrorLogger instead of concrete ErrorLogger class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore This are tasks or bot action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(ErrorLogger): replace concrete ErrorLogger usages with the IErrorLogger

2 participants