Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/modern-phones-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hashicorp/design-system-components": patch
---

<!-- START components/advanced-table -->
`AdvancedTable` - Fixed a bug in the cleanup logic of selectable rows where data updates caused the internal selection state to be incorrectly reset.
<!-- END -->
15 changes: 13 additions & 2 deletions packages/components/src/components/hds/advanced-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,20 @@ export default class HdsAdvancedTable extends Component<HdsAdvancedTableSignatur

@action
willDestroyRowCheckbox(selectionKey?: string): void {
this._selectableRows = this._selectableRows.filter(
(row) => row.selectionKey !== selectionKey
if (selectionKey === undefined) {
return;
}

const index = this._selectableRows.findIndex(
(row) => row.selectionKey === selectionKey
);

if (index === -1) {
return;
}

this._selectableRows.splice(index, 1);

this.setSelectAllState();
}

Expand Down