Skip to content

refactor(Table): add RenderLoader method reuse code snippet#7860

Merged
ArgoZhang merged 1 commit intomainfrom
feat-table-loader
Apr 11, 2026
Merged

refactor(Table): add RenderLoader method reuse code snippet#7860
ArgoZhang merged 1 commit intomainfrom
feat-table-loader

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Apr 11, 2026

Link issues

fixes #7859

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:

  • Introduce a reusable RenderLoader render fragment to centralize table loading markup and spinner/template handling.

Copilot AI review requested due to automatic review settings April 11, 2026 02:25
@bb-auto bb-auto bot added the enhancement New feature or request label Apr 11, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Apr 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the Table component’s loading UI by extracting the duplicated loading markup into a reusable RenderLoader RenderFragment, and then using this helper in the two call sites that display spinners while data is loading.

Class diagram for refactored Table loading UI

classDiagram
    class Table {
        +RenderFragment LoadingTemplate
        +bool ShowLoadingInFirstRender
        +RenderFragment RenderPagination
        +RenderFragment RenderRowContent
        +RenderFragment ValidateForm
        +RenderFragment~string~ RenderLoader(cssString)
    }

    class Spinner {
        +Color Color
    }

    class Color {
        <<enumeration>>
        Primary
    }

    Table ..> Spinner : uses
    Table ..> RenderFragment : defines
    Spinner ..> Color : uses
Loading

File-Level Changes

Change Details Files
Extract duplicated loading markup into a reusable RenderLoader RenderFragment helper.
  • Introduce a RenderFragment named RenderLoader that renders a wrapper div with a configurable CSS class, uses LoadingTemplate when provided, and falls back to a primary-colored Spinner otherwise.
  • Place the new RenderLoader definition in the Table.razor component code block for reuse by multiple loading areas.
src/BootstrapBlazor/Components/Table/Table.razor
Replace inline loading/snippet markup with calls to RenderLoader in Table component UI.
  • Update the initial loading state branch that previously rendered a div.table-loading with inline template/spinner logic to instead call @RenderLoader("table-loading").
  • Update the lower-page loader markup that previously rendered a div.table-loader with inline template/spinner logic to instead call @RenderLoader("table-loader").
src/BootstrapBlazor/Components/Table/Table.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#7859 Refactor the Table component to extract the duplicated loading UI into a reusable RenderLoader method and use it where the loader is shown.

Possibly linked issues


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.5.0 milestone Apr 11, 2026
@ArgoZhang ArgoZhang merged commit 7a882b8 into main Apr 11, 2026
6 checks passed
@ArgoZhang ArgoZhang deleted the feat-table-loader branch April 11, 2026 02:26
Copy link
Copy Markdown
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 left some high level feedback:

  • Consider replacing the RenderLoader parameter from a plain string to a more specific type or constants (e.g., an enum or named constants for "table-loading" / "table-loader") to avoid stringly-typed CSS class values scattered through the markup.
  • For consistency and readability, you might want to define RenderLoader as a method (e.g., RenderLoader(string cssClass)) rather than an expression-bodied RenderFragment<string> property, which can be harder to follow in Razor.
  • The null check style for LoadingTemplate changed from is not null to != null; aligning these checks to a single style across the component would improve consistency.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider replacing the `RenderLoader` parameter from a plain `string` to a more specific type or constants (e.g., an enum or named constants for `"table-loading"` / `"table-loader"`) to avoid stringly-typed CSS class values scattered through the markup.
- For consistency and readability, you might want to define `RenderLoader` as a method (e.g., `RenderLoader(string cssClass)`) rather than an expression-bodied `RenderFragment<string>` property, which can be harder to follow in Razor.
- The null check style for `LoadingTemplate` changed from `is not null` to `!= null`; aligning these checks to a single style across the component would improve consistency.

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.

Copy link
Copy Markdown
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

Refactors the Table component to reuse a single loader rendering fragment instead of duplicating the same loading markup in multiple places (addresses #7859).

Changes:

  • Replaced duplicated loading markup blocks with a shared RenderLoader fragment.
  • Introduced a parameterized RenderFragment<string> RenderLoader to render the loader with a provided CSS class.

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

}
else
{
<Spinner Color="Color.Primary"></Spinner>
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

Spinner is rendered with an explicit open/close tag here. Elsewhere in the codebase (and even earlier in this file) Spinner is typically self-closing (e.g., <Spinner ... />). For consistency and to avoid accidental whitespace/child-content semantics, consider switching this to a self-closing component tag.

Suggested change
<Spinner Color="Color.Primary"></Spinner>
<Spinner Color="Color.Primary" />

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (658476d) to head (e130d7a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7860   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          764       764           
  Lines        34176     34166   -10     
  Branches      4705      4704    -1     
=========================================
- Hits         34176     34166   -10     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(Table): add RenderLoader method reuse code snippet

2 participants