Skip to content

feat(Vditor): support ShowLabel parameter#653

Merged
ArgoZhang merged 2 commits intomasterfrom
dev-vditor
Nov 7, 2025
Merged

feat(Vditor): support ShowLabel parameter#653
ArgoZhang merged 2 commits intomasterfrom
dev-vditor

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Nov 7, 2025

Link issues

fixes #652

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

Add support for an optional label in the Vditor component and ensure it updates correctly beyond the first render

New Features:

  • Introduce ShowLabel parameter to toggle display of the BootstrapLabel in Vditor
  • Support ShowLabelTooltip for rendering label tooltips

Bug Fixes:

  • Remove early return in OnAfterRenderAsync to allow subsequent updates after initial render

Copilot AI review requested due to automatic review settings November 7, 2025 07:15
@bb-auto bb-auto Bot added the enhancement New feature or request label Nov 7, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Nov 7, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Nov 7, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR adds support for a ShowLabel parameter in the Vditor component by conditionally rendering a BootstrapLabel, and adjusts the OnAfterRenderAsync lifecycle method to remove an early return so that initialization logic flows correctly.

Sequence diagram for Vditor component rendering with ShowLabel

sequenceDiagram
    participant Vditor
    participant BootstrapLabel
    Vditor->>Vditor: Render()
    alt IsShowLabel == true
        Vditor->>BootstrapLabel: Render(required, for, ShowLabelTooltip, Value)
    end
    Vditor->>Vditor: Render <div> with attributes
Loading

Class diagram for updated Vditor component with ShowLabel parameter

classDiagram
    class Vditor {
        +bool IsShowLabel
        +bool Required
        +string Id
        +string DisplayText
        +bool ShowLabelTooltip
        +Dictionary<string, object> AdditionalAttributes
        +string ClassString
        +string Value
        +Task OnAfterRenderAsync(bool firstRender)
    }
    class BootstrapLabel {
        +bool required
        +string for
        +bool ShowLabelTooltip
        +string Value
    }
    Vditor --> BootstrapLabel : conditionally renders when IsShowLabel
Loading

File-Level Changes

Change Details Files
Add ShowLabel support in the Vditor Razor component
  • Insert an @if (IsShowLabel) block to render BootstrapLabel when enabled
src/components/BootstrapBlazor.Vditor/Vditor.razor
Refine OnAfterRenderAsync initialization flow
  • Remove the early 'return;' in the firstRender branch to allow post-render logic to execute
src/components/BootstrapBlazor.Vditor/Vditor.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#652 Add support for the ShowLabel parameter to the Vditor component, enabling conditional display of a label.

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

@ArgoZhang ArgoZhang merged commit 7f64361 into master Nov 7, 2025
3 of 4 checks passed
@ArgoZhang ArgoZhang deleted the dev-vditor branch November 7, 2025 07:15
Copy link
Copy Markdown

@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 there - 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.

Copy link
Copy Markdown

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 bumps the version to 9.0.1 and makes two key changes to the Vditor component: adds label support for form validation and fixes a rendering logic issue in the OnAfterRenderAsync lifecycle method.

  • Added BootstrapLabel rendering support when IsShowLabel is true
  • Removed early return in OnAfterRenderAsync on first render, allowing value synchronization to occur
  • Bumped version from 9.0.0 to 9.0.1

Reviewed Changes

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

File Description
Vditor.razor Added conditional label rendering using IsShowLabel property from ValidateBase
Vditor.razor.cs Removed early return statement in OnAfterRenderAsync to allow value updates on first render
BootstrapBlazor.Vditor.csproj Bumped package version to 9.0.1
Comments suppressed due to low confidence (1)

src/components/BootstrapBlazor.Vditor/Vditor.razor.cs:92

  • Removing the early return on firstRender allows the value synchronization logic (lines 85-92) to execute during the first render. However, at this point _vditor is still null because InvokeInitAsync() hasn't been called yet (it's called after OnAfterRenderAsync in the Blazor lifecycle). This means the setValue call will be skipped anyway due to the null check on line 88, making the removal of the early return ineffective for firstRender. The logic should either keep the early return, or ensure _vditor initialization happens before this check.
        if (firstRender)
        {
            _lastValue = Value;
        }

        if (_lastValue != Value)
        {
            _lastValue = Value;
            if (_vditor != null)
            {
                await _vditor.InvokeVoidAsync("setValue", Value, true);
            }
        }

💡 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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Vditor): support ShowLabel parameter

2 participants