Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jul 18, 2025

Link issues

fixes #6439

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

Default the IntersectionObserver to use its element viewport, explicitly opt LoadMore into the browser viewport, and update sample markup accordingly

Bug Fixes:

Enhancements:

  • Change IntersectionObserver.UseElementViewport default to true
  • Adjust formatting in the IntersectionObservers.razor sample

@ArgoZhang ArgoZhang requested a review from Copilot July 18, 2025 10:31
@bb-auto bb-auto bot added the enhancement New feature or request label Jul 18, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 18, 2025

Reviewer's Guide

This PR refactors the IntersectionObserver component by exposing the UseElementViewport parameter with a default of true, explicitly disables element viewport usage in the LoadMore component, and updates sample markup formatting for clarity.

Class diagram for IntersectionObserver parameter changes

classDiagram
    class IntersectionObserver {
        +bool UseElementViewport = true
        +string RootMargin
        +string Threshold
        +bool AutoUnobserveWhenIntersection
        +EventCallback OnIntersecting
    }
Loading

Class diagram for LoadMore usage of IntersectionObserver

classDiagram
    class LoadMore {
        +Task OnLoadMoreAsync
        +bool CanLoading
    }
    class IntersectionObserver {
        +bool UseElementViewport = true
    }
    LoadMore --|> IntersectionObserver : uses
    LoadMore : +UseElementViewport = false (in usage)
Loading

File-Level Changes

Change Details Files
Updated default value and documentation for UseElementViewport in IntersectionObserver
  • Set UseElementViewport default to true
  • Revised XML comments to reflect new default behavior
src/BootstrapBlazor/Components/IntersectionObserver/IntersectionObserver.razor.cs
Explicitly disabled element viewport in LoadMore
  • Added UseElementViewport="false" to IntersectionObserver in LoadMore
  • Ensured LoadMore uses browser viewport by default
src/BootstrapBlazor/Components/IntersectionObserver/LoadMore.razor
Cleaned up sample markup in IntersectionObservers.razor
  • Reformatted multi-line attributes for IntersectionObserver and LoadMore
  • Converted LoadMore tag to inline closing form
src/BootstrapBlazor.Server/Components/Samples/IntersectionObservers.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#6439 Refactor the LoadMore component to use UseElementViewport set to false in its IntersectionObserver.
#6439 Add a test parameter (UseElementViewport) to the IntersectionObserver in LoadMore to allow for element-viewport testing.
#6439 Refactor the LoadMore component to use UseElementViewport set to false in its IntersectionObserver.
#6439 Add a test parameter (UseElementViewport) to the IntersectionObserver in LoadMore to allow for element-viewport testing.

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 9.8.0 milestone Jul 18, 2025
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 LoadMore component by adding a test parameter to improve the component's intersection observer configuration. The change specifically adds the UseElementViewport="false" parameter to the IntersectionObserver component.

Key Changes:

  • Adds UseElementViewport="false" parameter to the IntersectionObserver component
  • Reformats the component tag for better readability with multi-line attribute layout

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Jul 18, 2025
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 @ArgoZhang - I've reviewed your changes - here's some feedback:

  • Rather than hard‐coding UseElementViewport="false" in the markup, consider exposing it as a [Parameter] on LoadMore so consumers can opt in or out.
  • The PR description could use a brief explanation of why UseElementViewport is being added and what behaviors it affects for better context during review.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Rather than hard‐coding UseElementViewport="false" in the markup, consider exposing it as a [Parameter] on LoadMore so consumers can opt in or out.
- The PR description could use a brief explanation of why UseElementViewport is being added and what behaviors it affects for better context during review.

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 Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (5e3dab8) to head (7976950).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6440   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          748       748           
  Lines        32259     32259           
  Branches      4560      4560           
=========================================
  Hits         32259     32259           
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.

@ArgoZhang ArgoZhang changed the title refactor(LoadMore): add test parameter refactor(LoadMore): add UseElementViewport parameter Jul 19, 2025
@ArgoZhang ArgoZhang changed the title refactor(LoadMore): add UseElementViewport parameter refactor(LoadMore): use UseElementViewport false value Jul 19, 2025
@ArgoZhang
Copy link
Member Author

@sourcery-ai review

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 @ArgoZhang - 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 merged commit c8bc51a into main Jul 19, 2025
7 checks passed
@ArgoZhang ArgoZhang deleted the refactor-observer branch July 19, 2025 01:20
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(LoadMore): use UseElementViewport false value

2 participants