Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix : toggleAllRowsSelected should respect row selection rules#6129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ttkien wants to merge3 commits intoTanStack:main
base:main
Choose a base branch
Loading
fromttkien:fix/toggle-all-rows-should-respect-row-selection-rules

Conversation

@ttkien
Copy link

@ttkienttkien commentedNov 27, 2025
edited
Loading

🎯 Changes

This pull request improves the row selection feature in the table core package by ensuring that selection and deselection operations respect theenableRowSelection configuration. It also adds comprehensive tests to verify this behavior for both selecting and deselecting all rows.

Bug Explanation:
When a row is selected and enableRowSelection is set to false, the row should remain selected because selection is supposed to be locked/disabled. However, when the user triggers Unselect All, the row becomes unselected even though selection is disabled.

Expected Behavior:
The row should remain selected when enableRowSelection = false, and the “Unselect All” action should not clear its selection state.

Actual Behavior:
The row is still unselected after “Unselect All,” meaning the selection state is not being preserved when selection is disabled.

Demo

tanstack-table-bug.mov

=> In demo, the rowBarney should not be unselected

Testing Enhancements:

  • Added new tests inRowSelection.test.ts to verify thattoggleAllRowsSelected correctly respects theenableRowSelection setting when selecting all rows, ensuring non-selectable rows remain unaffected.
  • Added tests to confirm that when deselecting all rows, rows that are not allowed to be deselected (according toenableRowSelection) retain their selection state.

✅ Checklist

  • I have followed the steps in theContributing guide.
  • I have tested this code locally withpnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated achangeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes

    • Fixed row selection to properly respect non-selectable rows when deselecting all rows, ensuring consistent behavior with select-all operations.
  • Tests

    • Added test coverage for row selection toggle operations to verify proper handling of non-selectable rows during bulk selection changes.

✏️ Tip: You can customize this high-level summary in your review settings.

truongnguyen-eh and phthhieu reacted with thumbs up emoji
@changeset-bot
Copy link

changeset-botbot commentedNov 27, 2025
edited
Loading

🦋 Changeset detected

Latest commit:34d1711

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
NameType
@tanstack/table-corePatch
@tanstack/angular-tablePatch
@tanstack/lit-tablePatch
@tanstack/qwik-tablePatch
@tanstack/react-tablePatch
@tanstack/solid-tablePatch
@tanstack/svelte-tablePatch
@tanstack/vue-tablePatch
@tanstack/react-table-devtoolsPatch

Not sure what this means?Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitaibot commentedNov 27, 2025
edited
Loading

Walkthrough

When toggling "select all" off, the code now skips rows that cannot be selected (rows wheregetCanSelect() is false) so their selection entries are not removed. Tests and a changeset were added to cover and document this behavior.

Changes

Cohort / File(s)Summary
Row selection logic fix
packages/table-core/src/features/RowSelection.ts
AdjustedtoggleAllRowsSelected so the path that deselects all skips rows withgetCanSelect() === false, preventing deletion of selection state for non-selectable rows.
Row selection tests
packages/table-core/tests/RowSelection.test.ts
Added tests fortoggleAllRowsSelected verifying select-all and deselect-all both respectenableRowSelection /getCanSelect() and leave non-selectable rows unchanged.
Release metadata
.changeset/eleven-dingos-drum.md
Added a changeset entry describing the bug fix and requesting a patch release for@tanstack/table-core.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review focus:
    • packages/table-core/src/features/RowSelection.ts — confirm the conditional skip logic and ensure no side effects.
    • packages/table-core/tests/RowSelection.test.ts — verify tests correctly model selectable vs non-selectable rows and assertions match intended behavior.
    • .changeset/* — confirm message and package target.

Poem

🐇 I hopped through rows both near and far,
Found one that said "no" — so I left its star.
Deselect the herd, but let that one be,
Tests nod and giggle — consistency, whee! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check nameStatusExplanation
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check✅ PassedThe title 'fix : toggleAllRowsSelected should respect row selection rules' directly and clearly summarizes the main change: a fix to the toggleAllRowsSelected function to respect row selection rules.
Description check✅ PassedThe pull request description comprehensively follows the template with detailed changes, complete checklist items, and release impact information.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for usingCodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment@coderabbitai help to get the list of available commands and usage tips.

@ttkienttkien changed the titlefeat(tests): add toggleAllRowsSelected tests to respect row selection rulesfix : toggleAllRowsSelected should respect row selection rulesNov 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@ttkien

[8]ページ先頭

©2009-2025 Movatter.jp