Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Feb 3, 2026

Link issues

fixes #7615

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 programmatic control for the current step index in the Step component and refine TreeView parameter XML documentation inheritance.

New Features:

  • Introduce a SetStepIndex API on the Step component to programmatically change the current step index.

Enhancements:

  • Clamp the programmatically set step index to valid bounds and trigger completion callbacks and UI refresh when appropriate.
  • Clarify XML documentation inheritance for TreeView CustomKeyAttribute and ModelEqualityComparer parameters to reference the corresponding interface members.

Copilot AI review requested due to automatic review settings February 3, 2026 05:25
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a new method to programmatically set the current step index in the Step component, and improves XML documentation inheritance for TreeView parameters related to IModelEqualityComparer.

Sequence diagram for the new SetStepIndex step update flow

sequenceDiagram
    actor Caller
    participant Step
    participant OnFinishedCallback

    Caller->>Step: SetStepIndex(index)
    activate Step
    Step->>Step: _currentStepIndex = clamp(index, 0, Items.Count)
    Step->>Step: check IsFinished
    alt IsFinished is true and OnFinishedCallback not null
        Step->>OnFinishedCallback: Invoke()
        activate OnFinishedCallback
        OnFinishedCallback-->>Step: Task completed
        deactivate OnFinishedCallback
    end
    Step->>Step: StateHasChanged()
    Step-->>Caller: Task completed
    deactivate Step
Loading

Updated class diagram for Step component with SetStepIndex

classDiagram
    class Step {
        int StepIndex
        int _currentStepIndex
        List~StepItem~ Items
        bool IsFinished
        Func Task OnFinishedCallback
        Task~int~ Next()
        Task SetStepIndex(int index)
        Task Reset()
    }
Loading

File-Level Changes

Change Details Files
Add API to programmatically set the current step index and trigger completion logic in the Step component.
  • Introduce asynchronous SetStepIndex(int index) method to update the internal current step index.
  • Clamp the requested index to the valid range based on Items.Count before assigning.
  • Invoke OnFinishedCallback when the newly set index represents a finished state and a callback is registered.
  • Request a UI re-render via StateHasChanged after changing the step index.
src/BootstrapBlazor/Components/Step/Step.razor.cs
Clarify XML documentation inheritance for TreeView model equality-related parameters.
  • Update CustomKeyAttribute parameter doc comment to inherit from IModelEqualityComparer.CustomKeyAttribute.
  • Update ModelEqualityComparer parameter doc comment to inherit from IModelEqualityComparer.ModelEqualityComparer.
src/BootstrapBlazor/Components/TreeView/TreeView.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7615 Enable programmatic switching of the Step component to a specific step index by using the StepIndex parameter (i.e., setting StepIndex should change the current StepItem). The PR adds a new SetStepIndex(int index) method that updates the internal _currentStepIndex and triggers StateHasChanged, but it does not change the behavior of the existing StepIndex parameter that the issue reports as not working. There is no modification showing StepIndex being observed, bound, or synchronized with _currentStepIndex. Therefore, directly setting the StepIndex parameter still appears ineffective, and the original bug about the StepIndex parameter not working is not resolved.

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 the bug Something isn't working label Feb 3, 2026
@bb-auto bb-auto bot added this to the v10.3.0 milestone Feb 3, 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 left some high level feedback:

  • In SetStepIndex, clamping with Math.Min(Items.Count, index) allows index == Items.Count, which is out of range for a 0-based Items collection; consider using Items.Count - 1 as the upper bound instead.
  • If StepIndex is a parameter or otherwise externally observable, consider updating any associated StepIndexChanged callback or notification paths in SetStepIndex so that consumers are kept in sync when the index is set programmatically.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In SetStepIndex, clamping with Math.Min(Items.Count, index) allows index == Items.Count, which is out of range for a 0-based Items collection; consider using Items.Count - 1 as the upper bound instead.
- If StepIndex is a parameter or otherwise externally observable, consider updating any associated StepIndexChanged callback or notification paths in SetStepIndex so that consumers are kept in sync when the index is set programmatically.

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.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7619   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          749       749           
  Lines        33007     33015    +8     
  Branches      4580      4581    +1     
=========================================
+ Hits         33007     33015    +8     
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.

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 adds a new SetStepIndex method to the Step component to address issue #7615, where users could not directly set the step index but only navigate using Prev() and Next() methods. The PR also includes unrelated documentation improvements to the TreeView component and bumps the version number.

Changes:

  • Added SetStepIndex method to allow programmatic setting of the current step index
  • Improved inheritdoc documentation references in TreeView component
  • Version bump from 10.3.1-beta03 to 10.3.1-beta04

Reviewed changes

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

File Description
src/BootstrapBlazor/Components/Step/Step.razor.cs Added new SetStepIndex method with bounds checking and OnFinishedCallback support
src/BootstrapBlazor/Components/TreeView/TreeView.razor.cs Improved documentation by adding specific cref attributes to inheritdoc tags
src/BootstrapBlazor/BootstrapBlazor.csproj Incremented version number to 10.3.1-beta04

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

@ArgoZhang ArgoZhang added enhancement New feature or request and removed bug Something isn't working labels Feb 3, 2026
@ArgoZhang ArgoZhang merged commit 1189cf0 into main Feb 3, 2026
6 checks passed
@ArgoZhang ArgoZhang deleted the dev-step branch February 3, 2026 05:36
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.

bug(Step): parameter StepIndex not work

1 participant