Skip to content

Commit 8fb14a2

Browse files
fix: [UIE-8142] - IAM RBAC: fix roles table expand (linode#12659)
* feat: [UIE-8142] - IAM RBAC: fix roles table expand * feat: [UIE-8142] - changeset
1 parent c7e6893 commit 8fb14a2

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
IAM RBAC: Accidental row expansion in Roles table when selecting roles via checkbox ([#12659](https://github.com/linode/manager/pull/12659))

packages/manager/src/features/IAM/Roles/RolesTable/RolesTable.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ interface Props {
4444
}
4545
const DEFAULT_PAGE_SIZE = 10;
4646
export const RolesTable = ({ roles = [] }: Props) => {
47-
const [expandedRows, setExpandedRows] = useState<string[]>([]);
4847
// Filter string for the search bar
4948
const [filterString, setFilterString] = React.useState('');
5049
const [filterableEntityType, setFilterableEntityType] =
@@ -147,12 +146,7 @@ export const RolesTable = ({ roles = [] }: Props) => {
147146
pagination.handlePageSizeChange(newSize);
148147
pagination.handlePageChange(1);
149148
};
150-
const handleExpandToggle = (e: React.MouseEvent, name: string) => {
151-
e.stopPropagation();
152-
setExpandedRows((prev) =>
153-
prev.includes(name) ? prev.filter((n) => n !== name) : [...prev, name]
154-
);
155-
};
149+
156150
return (
157151
<>
158152
<Paper sx={(theme) => ({ marginTop: theme.tokens.spacing.S16 })}>
@@ -253,7 +247,6 @@ export const RolesTable = ({ roles = [] }: Props) => {
253247
paginatedRows.map((roleRow) => (
254248
<TableRow
255249
expandable
256-
expanded={expandedRows.includes(roleRow.name)}
257250
hoverable
258251
key={roleRow.name}
259252
rowborder
@@ -262,7 +255,6 @@ export const RolesTable = ({ roles = [] }: Props) => {
262255
selected={selectedRows.includes(roleRow)}
263256
>
264257
<TableCell
265-
onClick={(e) => handleExpandToggle(e, roleRow.name)}
266258
style={{ minWidth: '26%', wordBreak: 'break-word' }}
267259
>
268260
{roleRow.name}
@@ -296,11 +288,7 @@ export const RolesTable = ({ roles = [] }: Props) => {
296288
slot="expanded"
297289
style={{ marginBottom: 12, padding: 0, width: '100%' }}
298290
>
299-
{expandedRows.includes(roleRow.name) && (
300-
<RolesTableExpandedRow
301-
permissions={roleRow.permissions}
302-
/>
303-
)}
291+
<RolesTableExpandedRow permissions={roleRow.permissions} />
304292
</TableRowExpanded>
305293
</TableRow>
306294
))

0 commit comments

Comments
 (0)