Skip to content

fix(Table): prevent javascript error when set IsDetails to true#7813

Merged
ArgoZhang merged 2 commits intomainfrom
fix-table
Mar 29, 2026
Merged

fix(Table): prevent javascript error when set IsDetails to true#7813
ArgoZhang merged 2 commits intomainfrom
fix-table

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Mar 28, 2026

Link issues

fixes #7802

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

Bug Fixes:

  • Prevent a JavaScript error during table column resize when a row header element is missing, such as when IsDetails is set to true.

Copilot AI review requested due to automatic review settings March 28, 2026 11:22
@bb-auto bb-auto bot added the bug Something isn't working label Mar 28, 2026
@bb-auto bb-auto bot added this to the v10.4.0 milestone Mar 28, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 28, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a null check before accessing a table row header's classList during column resize logic to prevent JavaScript errors when IsDetails is true.

File-Level Changes

Change Details Files
Guard table resize logic against null header elements to avoid runtime errors when computing widths for fixed columns.
  • Update the resize listener loop to verify the retrieved row child element is not null before checking its CSS classes.
  • Ensure resizeNextFixedColumnWidth is only invoked when a valid header element exists and has the 'fixed' class.
src/BootstrapBlazor/Components/Table/Table.razor.js

Assessment against linked issues

Issue Objective Addressed Explanation
#7802 Prevent the JavaScript runtime error ('Cannot read properties of null (reading "classList")') when the Table component has both AllowResizing="true" and IsDetails="true" enabled.
#7802 Ensure column resizing logic in Table.razor.js safely handles rows where the target cell may be null, without breaking the resizing behavior.

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

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 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
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

Fixes a JavaScript runtime error in the Table component when column resizing is enabled alongside detail rows (IsDetails=true), and updates the package version.

Changes:

  • Add a null-guard when resizing columns to avoid accessing classList on a missing cell element.
  • Bump BootstrapBlazor package version to 10.5.0-beta04.

Reviewed changes

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

File Description
src/BootstrapBlazor/Components/Table/Table.razor.js Prevents a null dereference during resize handling when some rows don’t have a cell at the resized column index.
src/BootstrapBlazor/BootstrapBlazor.csproj Updates the package version metadata.

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

Comment thread src/BootstrapBlazor/Components/Table/Table.razor.js
Comment thread src/BootstrapBlazor/BootstrapBlazor.csproj
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7813   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          764       764           
  Lines        34128     34128           
  Branches      4697      4697           
=========================================
  Hits         34128     34128           
Flag Coverage Δ
BB 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.

@ArgoZhang ArgoZhang merged commit 41abea9 into main Mar 29, 2026
10 checks passed
@ArgoZhang ArgoZhang deleted the fix-table branch March 29, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Table): 表格组件同时启用 AllowResizing 和 IsDetails 报脚本错误

2 participants