Skip to content

Fix: responsive grids - #311

Open
santipalenque wants to merge 3 commits into
mainfrom
fix/responsive-mui-table
Open

Fix: responsive grids#311
santipalenque wants to merge 3 commits into
mainfrom
fix/responsive-mui-table

Conversation

@santipalenque

@santipalenque santipalenque commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

https://app.clickup.com/t/9014802374/86bb7tvh1

Summary by CodeRabbit

  • New Features
    • Added refreshed editable, sortable, and standard table experiences with responsive layouts, pagination, row actions, drag-and-drop ordering, and deletion confirmation.
    • Added inline editing with validation and save-on-blur or Enter behavior.
    • Added support for payment, fee, refund, discount, notes, and total detail rows.
    • Added responsive action menus and horizontal scroll indicators.
  • Enhancements
    • Improved boolean and custom cell rendering behavior.
    • Standardized tooltip text sizing for improved readability.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e76a6e75-5930-4cee-8a49-64a1205c7f32

📥 Commits

Reviewing files that changed from the base of the PR and between e7face6 and d0aa639.

📒 Files selected for processing (38)
  • src/components/index.js
  • src/components/mui/BulkEditTable/BulkEditTable.js
  • src/components/mui/MuiBaseCustomTheme.js
  • src/components/mui/SponsorOrderGrid/index.js
  • src/components/mui/__tests__/fee-row.test.js
  • src/components/mui/__tests__/mui-table-editable.test.js
  • src/components/mui/__tests__/mui-table-sortable.test.js
  • src/components/mui/__tests__/mui-table.test.js
  • src/components/mui/__tests__/notes-row.test.js
  • src/components/mui/__tests__/payment-row.test.js
  • src/components/mui/__tests__/refund-row.test.js
  • src/components/mui/__tests__/total-row.test.js
  • src/components/mui/editable-table/mui-table-editable.js
  • src/components/mui/editable-table/mui-table-editable.module.less
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/sortable-table/styles.module.less
  • src/components/mui/table/mui-table.js
  • src/components/mui/tables/components/CustomTablePagination.js
  • src/components/mui/tables/components/create-delete-handler.js
  • src/components/mui/tables/components/row-actions-menu.js
  • src/components/mui/tables/components/scroll-fade-overlay.js
  • src/components/mui/tables/components/sortable-header-content.js
  • src/components/mui/tables/components/styles.module.less
  • src/components/mui/tables/components/table-cell-content.js
  • src/components/mui/tables/components/table-shell.js
  • src/components/mui/tables/components/table-styles.js
  • src/components/mui/tables/components/use-scroll-fade.js
  • src/components/mui/tables/editable-table/index.js
  • src/components/mui/tables/extra-rows/DiscountRow.jsx
  • src/components/mui/tables/extra-rows/FeeRow.jsx
  • src/components/mui/tables/extra-rows/NotesRow.jsx
  • src/components/mui/tables/extra-rows/PaymentRow.jsx
  • src/components/mui/tables/extra-rows/RefundRow.jsx
  • src/components/mui/tables/extra-rows/TotalRow.jsx
  • src/components/mui/tables/extra-rows/index.js
  • src/components/mui/tables/mui-table/index.js
  • src/components/mui/tables/sortable-table/index.js
  • webpack.common.js
💤 Files with no reviewable changes (5)
  • src/components/mui/sortable-table/styles.module.less
  • src/components/mui/editable-table/mui-table-editable.module.less
  • src/components/mui/table/mui-table.js
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/editable-table/mui-table-editable.js

📝 Walkthrough

Walkthrough

The PR rebuilds MUI table components under src/components/mui/tables, adds shared table utilities and extra-row components, removes legacy implementations, and updates exports, imports, tests, and Webpack entries.

Changes

MUI table restructuring

Layer / File(s) Summary
Shared table foundation
src/components/mui/tables/components/*, src/components/mui/MuiBaseCustomTheme.js
Adds shared table layout, styling, scroll-fade, sorting-header, row-action, deletion, and pagination utilities. Custom cell renderers now take precedence over boolean rendering.
Extra table rows
src/components/mui/tables/extra-rows/*, src/components/mui/SponsorOrderGrid/index.js, src/components/mui/__tests__/*row.test.js
Adds six extra-row components and a barrel export. Consumers and tests use the new paths.
Editable table
src/components/mui/tables/editable-table/index.js, src/components/mui/__tests__/mui-table-editable.test.js
Adds inline editing, validation, sorting, pagination, and row actions.
Standard MUI table
src/components/mui/tables/mui-table/index.js, src/components/mui/__tests__/mui-table.test.js
Adds sorting, responsive actions, archived-row handling, deletion confirmation, injected children, and empty-state rendering.
Sortable table
src/components/mui/tables/sortable-table/index.js, src/components/mui/__tests__/mui-table-sortable.test.js
Adds drag-and-drop reordering with pagination, sorting, edit/delete actions, and empty-state rendering.
Export and build integration
src/components/index.js, src/components/mui/BulkEditTable/BulkEditTable.js, webpack.common.js
Updates public exports, imports, and Webpack entries for the new table locations.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MuiTable
  participant TableShell
  participant SortableHeaderContent
  participant TableCellContent
  participant RowActionsMenu
  participant createDeleteHandler
  MuiTable->>TableShell: render table content and pagination
  MuiTable->>SortableHeaderContent: provide sort state and callback
  MuiTable->>TableCellContent: render row cell values
  MuiTable->>RowActionsMenu: provide responsive row actions
  RowActionsMenu->>createDeleteHandler: invoke delete action
  createDeleteHandler-->>MuiTable: confirm item deletion
Loading

Possibly related PRs

Suggested reviewers: smarcet

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the PR's primary focus on responsive behavior in MUI tables and table actions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/responsive-mui-table

Thanks for using CodeRabbit! 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

🧹 Nitpick comments (1)
src/components/mui/tables/mui-table/index.js (1)

203-203: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Coerce disabled to a boolean.

options.disableProp && row[options.disableProp] can evaluate to null, undefined, a string, or a number. IconButton expects a boolean for disabled. getRowActions already applies !!(...) for the same conditions, so the menu path and the icon path can disagree in typing. Apply !! at each icon button for consistency.

♻️ Proposed change
-                        disabled={options.disableProp && row[options.disableProp]}
+                        disabled={!!(options.disableProp && row[options.disableProp])}

Also applies to: 234-238, 268-268, 293-293

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/mui-table/index.js` at line 203, Update each
IconButton disabled prop in the table row-action rendering, including the
instances near the current expression and the additional highlighted locations,
to coerce the disable condition with !!. Match the boolean coercion already used
by getRowActions so every icon path passes a boolean to IconButton.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/mui/tables/components/create-delete-handler.js`:
- Around line 19-20: Update the dialog options in create-delete-handler to use
the showConfirmDialog API field iconType instead of type, preserving the
"warning" value so the delete confirmation displays its warning state.
- Around line 4-10: Update createDeleteHandler to accept a getId callback and
use it when invoking onDelete instead of always reading item.id. In
sortable-table, pass a callback that returns item[idKey], preserving the
configured row identifier for deletion while retaining existing behavior for the
default idKey.

In `@src/components/mui/tables/components/row-actions-menu.js`:
- Around line 28-34: Add a localized aria-label to the icon-only IconButton that
opens the row actions menu, using the component’s existing localization
mechanism and an existing translation key where available. Preserve the current
click behavior and data-testid.

In `@src/components/mui/tables/components/sortable-header-content.js`:
- Around line 15-17: Update the onClick handler in the sortable header content
to pass ascending order when col.columnKey differs from sortCol, and only negate
sortDir when the clicked column is already active. Preserve the existing column
key passed to onSort.

In `@src/components/mui/tables/components/styles.module.less`:
- Around line 7-12: Center the absolutely positioned border pseudo-element by
updating its positioning declarations: replace the top-zero alignment with top:
50% and apply a vertical translate matching half its 60% height. Remove the
ineffective align-self declaration while preserving the existing bottom, left,
border, and height styling.

In `@src/components/mui/tables/components/use-scroll-fade.js`:
- Around line 15-23: Update the React.useEffect around updateFades to observe
container and table dimension changes with a ResizeObserver, invoking
updateFades when either resizes. Observe the relevant container and table
elements, and disconnect the observer during cleanup alongside removing the
scroll listener.

In `@src/components/mui/tables/editable-table/index.js`:
- Around line 251-263: Update the editable-cell TableCell rendering around
isEditable, adding tabIndex only for editable cells and handling Enter or Space
keyboard activation by invoking handleCellClick with the row and column key.
Ignore keyboard events originating from the nested TextField, while preserving
non-editable cell behavior.

In `@src/components/mui/tables/mui-table/index.js`:
- Around line 115-119: Update the select action in the table component to use
the existing T.translate mechanism for the "View" label, including both the menu
entry and its tooltip. Add or reuse the appropriate translation key so both
visible labels follow the current locale while preserving the existing onSelect
behavior.
- Line 180: Update the className construction in the table cell rendering to
omit falsy or undefined values instead of interpolating them as strings.
Preserve both the conditional dotted-border class from col.dottedBorder and
col.className when present, while ensuring the rendered class list contains only
valid class names.

In `@src/components/mui/tables/sortable-table/index.js`:
- Around line 77-80: Use the configured idKey consistently for item identity in
the sortable table. Update the reorder logic around movedItemId and the
createDeleteHandler helper to derive IDs through a getId callback, then pass
(item) => item[idKey] when creating the delete handler so onReorder and onDelete
receive the configured item ID.
- Around line 182-217: Add localized aria-label values to the edit, delete, and
reorder IconButton elements in the table row actions, using the existing
localization mechanism and clear action-specific labels while preserving their
current click and drag behavior.
- Around line 66-75: Update the reorder logic around reordered and
updateOrderKey so assigning the new order does not mutate item objects supplied
through data. Create new item objects when applying updateOrderKey, while
preserving unchanged item references or values as appropriate, then pass the
resulting reordered collection to onReorder.

---

Nitpick comments:
In `@src/components/mui/tables/mui-table/index.js`:
- Line 203: Update each IconButton disabled prop in the table row-action
rendering, including the instances near the current expression and the
additional highlighted locations, to coerce the disable condition with !!. Match
the boolean coercion already used by getRowActions so every icon path passes a
boolean to IconButton.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e76a6e75-5930-4cee-8a49-64a1205c7f32

📥 Commits

Reviewing files that changed from the base of the PR and between e7face6 and d0aa639.

📒 Files selected for processing (38)
  • src/components/index.js
  • src/components/mui/BulkEditTable/BulkEditTable.js
  • src/components/mui/MuiBaseCustomTheme.js
  • src/components/mui/SponsorOrderGrid/index.js
  • src/components/mui/__tests__/fee-row.test.js
  • src/components/mui/__tests__/mui-table-editable.test.js
  • src/components/mui/__tests__/mui-table-sortable.test.js
  • src/components/mui/__tests__/mui-table.test.js
  • src/components/mui/__tests__/notes-row.test.js
  • src/components/mui/__tests__/payment-row.test.js
  • src/components/mui/__tests__/refund-row.test.js
  • src/components/mui/__tests__/total-row.test.js
  • src/components/mui/editable-table/mui-table-editable.js
  • src/components/mui/editable-table/mui-table-editable.module.less
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/sortable-table/styles.module.less
  • src/components/mui/table/mui-table.js
  • src/components/mui/tables/components/CustomTablePagination.js
  • src/components/mui/tables/components/create-delete-handler.js
  • src/components/mui/tables/components/row-actions-menu.js
  • src/components/mui/tables/components/scroll-fade-overlay.js
  • src/components/mui/tables/components/sortable-header-content.js
  • src/components/mui/tables/components/styles.module.less
  • src/components/mui/tables/components/table-cell-content.js
  • src/components/mui/tables/components/table-shell.js
  • src/components/mui/tables/components/table-styles.js
  • src/components/mui/tables/components/use-scroll-fade.js
  • src/components/mui/tables/editable-table/index.js
  • src/components/mui/tables/extra-rows/DiscountRow.jsx
  • src/components/mui/tables/extra-rows/FeeRow.jsx
  • src/components/mui/tables/extra-rows/NotesRow.jsx
  • src/components/mui/tables/extra-rows/PaymentRow.jsx
  • src/components/mui/tables/extra-rows/RefundRow.jsx
  • src/components/mui/tables/extra-rows/TotalRow.jsx
  • src/components/mui/tables/extra-rows/index.js
  • src/components/mui/tables/mui-table/index.js
  • src/components/mui/tables/sortable-table/index.js
  • webpack.common.js
💤 Files with no reviewable changes (5)
  • src/components/mui/sortable-table/styles.module.less
  • src/components/mui/editable-table/mui-table-editable.module.less
  • src/components/mui/table/mui-table.js
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/editable-table/mui-table-editable.js

Comment on lines +4 to +10
const createDeleteHandler = ({
onDelete,
getName = (item) => item.name,
deleteDialogTitle,
deleteDialogBody,
deleteDialogConfirmText,
confirmButtonColor

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Use the configured row identifier for deletion.

Line 27 always passes item.id to onDelete.

src/components/mui/tables/sortable-table/index.js supports idKey. If a row uses a non-id key, deletion receives undefined.

Add a getId callback to this factory. Pass item[idKey] from the sortable table.

Proposed fix
 const createDeleteHandler = ({
   onDelete,
+  getId = (item) => item.id,
   getName = (item) => item.name,
@@
   if (isConfirmed) {
-    onDelete(item.id);
+    onDelete(getId(item));
   }
 };

Also applies to: 26-28

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/components/create-delete-handler.js` around lines 4
- 10, Update createDeleteHandler to accept a getId callback and use it when
invoking onDelete instead of always reading item.id. In sortable-table, pass a
callback that returns item[idKey], preserving the configured row identifier for
deletion while retaining existing behavior for the default idKey.

Comment on lines +19 to +20
type: "warning",
showCancelButton: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Pass the warning icon with the dialog API field name.

showConfirmDialog reads iconType. It ignores type.

Replace type: "warning" with iconType: "warning" so the delete confirmation shows its warning state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/components/create-delete-handler.js` around lines
19 - 20, Update the dialog options in create-delete-handler to use the
showConfirmDialog API field iconType instead of type, preserving the "warning"
value so the delete confirmation displays its warning state.

Comment on lines +28 to +34
<IconButton
size="small"
onClick={(e) => setAnchorEl(e.currentTarget)}
data-testid="row-actions-menu-trigger"
>
<MoreVertIcon fontSize="small" />
</IconButton>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add an accessible name to the actions trigger.

The icon-only IconButton has no aria-label.

Add a localized aria-label that identifies the row actions menu.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/components/row-actions-menu.js` around lines 28 -
34, Add a localized aria-label to the icon-only IconButton that opens the row
actions menu, using the component’s existing localization mechanism and an
existing translation key where available. Preserve the current click behavior
and data-testid.

Comment on lines +15 to +17
active={sortCol === col.columnKey}
direction={sortCol === col.columnKey && sortDir === -1 ? "desc" : "asc"}
onClick={() => onSort(col.columnKey, sortDir * -1)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Start a newly selected column in ascending order.

Line 17 toggles sortDir even when the user selects a different column.

If the active column is ascending, the next column starts descending. Use ascending order for a new column. Only toggle when sortCol === col.columnKey.

Proposed fix
-      onClick={() => onSort(col.columnKey, sortDir * -1)}
+      onClick={() =>
+        onSort(
+          col.columnKey,
+          sortCol === col.columnKey && sortDir === 1 ? -1 : 1
+        )
+      }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
active={sortCol === col.columnKey}
direction={sortCol === col.columnKey && sortDir === -1 ? "desc" : "asc"}
onClick={() => onSort(col.columnKey, sortDir * -1)}
active={sortCol === col.columnKey}
direction={sortCol === col.columnKey && sortDir === -1 ? "desc" : "asc"}
onClick={() =>
onSort(
col.columnKey,
sortCol === col.columnKey && sortDir === 1 ? -1 : 1
)
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/components/sortable-header-content.js` around lines
15 - 17, Update the onClick handler in the sortable header content to pass
ascending order when col.columnKey differs from sortCol, and only negate sortDir
when the clicked column is already active. Preserve the existing column key
passed to onSort.

Comment on lines +15 to +23
React.useEffect(() => {
const el = containerRef.current;
if (!el) return undefined;

updateFades();
el.addEventListener("scroll", updateFades);

return () => el.removeEventListener("scroll", updateFades);
}, [updateFades]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Update fade state when layout dimensions change.

The hook updates fades only on mount and scroll.

If the viewport, container, or table width changes, showLeftFade and showRightFade can remain stale until the user scrolls.

Observe the container and table size changes, then call updateFades. Disconnect the observer during cleanup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/components/use-scroll-fade.js` around lines 15 -
23, Update the React.useEffect around updateFades to observe container and table
dimension changes with a ResizeObserver, invoking updateFades when either
resizes. Observe the relevant container and table elements, and disconnect the
observer during cleanup alongside removing the scroll listener.

Comment on lines +115 to +119
onSelect && {
label: "View",
onClick: () => onSelect(row),
disabled: !!(options.disableProp && row[options.disableProp])
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Translate the "View" action label.

Every other action label uses T.translate. The select action uses the hardcoded string "View" in both the menu entry and the tooltip. Add a translation key so the label follows the locale.

🌐 Proposed fix
       onSelect && {
-        label: "View",
+        label: T.translate("general.view"),
-                  <Tooltip title="View">
+                  <Tooltip title={T.translate("general.view")}>

Also applies to: 286-286

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/mui-table/index.js` around lines 115 - 119, Update
the select action in the table component to use the existing T.translate
mechanism for the "View" label, including both the menu entry and its tooltip.
Add or reuse the appropriate translation key so both visible labels follow the
current locale while preserving the existing onSelect behavior.

<TableCell
key={col.columnKey}
align={col.align ?? "left"}
className={`${col.dottedBorder && styles.dottedBorderLeft} ${col.className}`}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove falsy values from the generated class name.

If col.dottedBorder is falsy, the template literal inserts the string false. If col.className is undefined, it inserts undefined. The rendered class attribute then contains "false undefined". Build the class list from defined values only.

🔧 Proposed fix
-                  className={`${col.dottedBorder && styles.dottedBorderLeft} ${col.className}`}
+                  className={[
+                    col.dottedBorder && styles.dottedBorderLeft,
+                    col.className
+                  ]
+                    .filter(Boolean)
+                    .join(" ")}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className={`${col.dottedBorder && styles.dottedBorderLeft} ${col.className}`}
className={[
col.dottedBorder && styles.dottedBorderLeft,
col.className
]
.filter(Boolean)
.join(" ")}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/mui-table/index.js` at line 180, Update the
className construction in the table cell rendering to omit falsy or undefined
values instead of interpolating them as strings. Preserve both the conditional
dotted-border class from col.dottedBorder and col.className when present, while
ensuring the rendered class list contains only valid class names.

Comment on lines +66 to +75
const reordered = [...data];
const [movedItem] = reordered.splice(result.source.index, 1);
reordered.splice(result.destination.index, 0, movedItem);

// change value based on updateOrderKey
if (updateOrderKey) {
reordered.forEach((item, idx) => {
item[updateOrderKey] = idx + 1;
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not mutate items received through data.

reordered copies the array but retains each item reference. Lines 72-74 then mutate caller-owned items before onReorder accepts or persists the change. Create new item objects before assigning updateOrderKey.

Proposed fix
-    const reordered = [...data];
+    const reordered = data.map((item) => ({ ...item }));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const reordered = [...data];
const [movedItem] = reordered.splice(result.source.index, 1);
reordered.splice(result.destination.index, 0, movedItem);
// change value based on updateOrderKey
if (updateOrderKey) {
reordered.forEach((item, idx) => {
item[updateOrderKey] = idx + 1;
});
}
const reordered = data.map((item) => ({ ...item }));
const [movedItem] = reordered.splice(result.source.index, 1);
reordered.splice(result.destination.index, 0, movedItem);
// change value based on updateOrderKey
if (updateOrderKey) {
reordered.forEach((item, idx) => {
item[updateOrderKey] = idx + 1;
});
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/sortable-table/index.js` around lines 66 - 75,
Update the reorder logic around reordered and updateOrderKey so assigning the
new order does not mutate item objects supplied through data. Create new item
objects when applying updateOrderKey, while preserving unchanged item references
or values as appropriate, then pass the resulting reordered collection to
onReorder.

Comment on lines +77 to +80
const movedItemId = movedItem.id;
const newOrder = reordered.find(
(item) => item[idKey || "id"] === movedItemId
)?.[updateOrderKey];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use idKey for all item identity callbacks.

Line 77 always reads movedItem.id, while line 79 compares with idKey. If callers configure idKey, onReorder receives an incorrect item ID and usually an undefined newOrder.

Deletion has the same defect. createDeleteHandler calls onDelete(item.id). Add a getId callback to that helper, then pass (item) => item[idKey] from this table.

Also applies to: 85-91

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/sortable-table/index.js` around lines 77 - 80, Use
the configured idKey consistently for item identity in the sortable table.
Update the reorder logic around movedItemId and the createDeleteHandler helper
to derive IDs through a getId callback, then pass (item) => item[idKey] when
creating the delete handler so onReorder and onDelete receive the configured
item ID.

Comment on lines +182 to +217
<IconButton
size="large"
onClick={() => onEdit(row)}
sx={{ padding: 0 }}
>
<EditIcon fontSize="large" />
</IconButton>
</TableCell>
)}
{/* Delete column */}
{onDelete && (
<TableCell
align="center"
sx={getActionCellSx(row)}
className={styles.dottedBorderLeft}
>
<IconButton
size="large"
onClick={() => handleDelete(row)}
sx={{ padding: 0 }}
>
<DeleteIcon fontSize="large" />
</IconButton>
</TableCell>
)}
{/* Re order column */}
{onReorder && (
<TableCell
align="center"
sx={getActionCellSx(row)}
className={styles.dottedBorderLeft}
{...provided.dragHandleProps}
>
<IconButton size="large">
<UnfoldMoreIcon fontSize="large" />
</IconButton>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add accessible names to the action buttons.

The edit, delete, and reorder buttons contain only icons. Screen reader users cannot identify their actions. Add localized aria-label values to all three IconButton elements.

🧰 Tools
🪛 ast-grep (0.45.0)

[warning] 186-186: A list component should have a key to prevent re-rendering
Context:
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)


[warning] 192-204: A list component should have a key to prevent re-rendering
Context:
<IconButton
size="large"
onClick={() => handleDelete(row)}
sx={{ padding: 0 }}
>



Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)


[warning] 197-203: A list component should have a key to prevent re-rendering
Context: <IconButton
size="large"
onClick={() => handleDelete(row)}
sx={{ padding: 0 }}
>


Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)


[warning] 202-202: A list component should have a key to prevent re-rendering
Context:
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)


[warning] 208-217: A list component should have a key to prevent re-rendering
Context: <TableCell
align="center"
sx={getActionCellSx(row)}
className={styles.dottedBorderLeft}
{...provided.dragHandleProps}
>




Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)


[warning] 214-216: A list component should have a key to prevent re-rendering
Context:


Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)


[warning] 215-215: A list component should have a key to prevent re-rendering
Context:
Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/sortable-table/index.js` around lines 182 - 217,
Add localized aria-label values to the edit, delete, and reorder IconButton
elements in the table row actions, using the existing localization mechanism and
clear action-specific labels while preserving their current click and drag
behavior.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 12

🧹 Nitpick comments (1)
src/components/mui/tables/mui-table/index.js (1)

203-203: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Coerce disabled to a boolean.

options.disableProp && row[options.disableProp] can evaluate to null, undefined, a string, or a number. IconButton expects a boolean for disabled. getRowActions already applies !!(...) for the same conditions, so the menu path and the icon path can disagree in typing. Apply !! at each icon button for consistency.

♻️ Proposed change
-                        disabled={options.disableProp && row[options.disableProp]}
+                        disabled={!!(options.disableProp && row[options.disableProp])}

Also applies to: 234-238, 268-268, 293-293

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/mui-table/index.js` at line 203, Update each
IconButton disabled prop in the table row-action rendering, including the
instances near the current expression and the additional highlighted locations,
to coerce the disable condition with !!. Match the boolean coercion already used
by getRowActions so every icon path passes a boolean to IconButton.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/mui/tables/components/create-delete-handler.js`:
- Around line 19-20: Update the dialog options in create-delete-handler to use
the showConfirmDialog API field iconType instead of type, preserving the
"warning" value so the delete confirmation displays its warning state.
- Around line 4-10: Update createDeleteHandler to accept a getId callback and
use it when invoking onDelete instead of always reading item.id. In
sortable-table, pass a callback that returns item[idKey], preserving the
configured row identifier for deletion while retaining existing behavior for the
default idKey.

In `@src/components/mui/tables/components/row-actions-menu.js`:
- Around line 28-34: Add a localized aria-label to the icon-only IconButton that
opens the row actions menu, using the component’s existing localization
mechanism and an existing translation key where available. Preserve the current
click behavior and data-testid.

In `@src/components/mui/tables/components/sortable-header-content.js`:
- Around line 15-17: Update the onClick handler in the sortable header content
to pass ascending order when col.columnKey differs from sortCol, and only negate
sortDir when the clicked column is already active. Preserve the existing column
key passed to onSort.

In `@src/components/mui/tables/components/styles.module.less`:
- Around line 7-12: Center the absolutely positioned border pseudo-element by
updating its positioning declarations: replace the top-zero alignment with top:
50% and apply a vertical translate matching half its 60% height. Remove the
ineffective align-self declaration while preserving the existing bottom, left,
border, and height styling.

In `@src/components/mui/tables/components/use-scroll-fade.js`:
- Around line 15-23: Update the React.useEffect around updateFades to observe
container and table dimension changes with a ResizeObserver, invoking
updateFades when either resizes. Observe the relevant container and table
elements, and disconnect the observer during cleanup alongside removing the
scroll listener.

In `@src/components/mui/tables/editable-table/index.js`:
- Around line 251-263: Update the editable-cell TableCell rendering around
isEditable, adding tabIndex only for editable cells and handling Enter or Space
keyboard activation by invoking handleCellClick with the row and column key.
Ignore keyboard events originating from the nested TextField, while preserving
non-editable cell behavior.

In `@src/components/mui/tables/mui-table/index.js`:
- Around line 115-119: Update the select action in the table component to use
the existing T.translate mechanism for the "View" label, including both the menu
entry and its tooltip. Add or reuse the appropriate translation key so both
visible labels follow the current locale while preserving the existing onSelect
behavior.
- Line 180: Update the className construction in the table cell rendering to
omit falsy or undefined values instead of interpolating them as strings.
Preserve both the conditional dotted-border class from col.dottedBorder and
col.className when present, while ensuring the rendered class list contains only
valid class names.

In `@src/components/mui/tables/sortable-table/index.js`:
- Around line 77-80: Use the configured idKey consistently for item identity in
the sortable table. Update the reorder logic around movedItemId and the
createDeleteHandler helper to derive IDs through a getId callback, then pass
(item) => item[idKey] when creating the delete handler so onReorder and onDelete
receive the configured item ID.
- Around line 182-217: Add localized aria-label values to the edit, delete, and
reorder IconButton elements in the table row actions, using the existing
localization mechanism and clear action-specific labels while preserving their
current click and drag behavior.
- Around line 66-75: Update the reorder logic around reordered and
updateOrderKey so assigning the new order does not mutate item objects supplied
through data. Create new item objects when applying updateOrderKey, while
preserving unchanged item references or values as appropriate, then pass the
resulting reordered collection to onReorder.

---

Nitpick comments:
In `@src/components/mui/tables/mui-table/index.js`:
- Line 203: Update each IconButton disabled prop in the table row-action
rendering, including the instances near the current expression and the
additional highlighted locations, to coerce the disable condition with !!. Match
the boolean coercion already used by getRowActions so every icon path passes a
boolean to IconButton.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e76a6e75-5930-4cee-8a49-64a1205c7f32

📥 Commits

Reviewing files that changed from the base of the PR and between e7face6 and d0aa639.

📒 Files selected for processing (38)
  • src/components/index.js
  • src/components/mui/BulkEditTable/BulkEditTable.js
  • src/components/mui/MuiBaseCustomTheme.js
  • src/components/mui/SponsorOrderGrid/index.js
  • src/components/mui/__tests__/fee-row.test.js
  • src/components/mui/__tests__/mui-table-editable.test.js
  • src/components/mui/__tests__/mui-table-sortable.test.js
  • src/components/mui/__tests__/mui-table.test.js
  • src/components/mui/__tests__/notes-row.test.js
  • src/components/mui/__tests__/payment-row.test.js
  • src/components/mui/__tests__/refund-row.test.js
  • src/components/mui/__tests__/total-row.test.js
  • src/components/mui/editable-table/mui-table-editable.js
  • src/components/mui/editable-table/mui-table-editable.module.less
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/sortable-table/styles.module.less
  • src/components/mui/table/mui-table.js
  • src/components/mui/tables/components/CustomTablePagination.js
  • src/components/mui/tables/components/create-delete-handler.js
  • src/components/mui/tables/components/row-actions-menu.js
  • src/components/mui/tables/components/scroll-fade-overlay.js
  • src/components/mui/tables/components/sortable-header-content.js
  • src/components/mui/tables/components/styles.module.less
  • src/components/mui/tables/components/table-cell-content.js
  • src/components/mui/tables/components/table-shell.js
  • src/components/mui/tables/components/table-styles.js
  • src/components/mui/tables/components/use-scroll-fade.js
  • src/components/mui/tables/editable-table/index.js
  • src/components/mui/tables/extra-rows/DiscountRow.jsx
  • src/components/mui/tables/extra-rows/FeeRow.jsx
  • src/components/mui/tables/extra-rows/NotesRow.jsx
  • src/components/mui/tables/extra-rows/PaymentRow.jsx
  • src/components/mui/tables/extra-rows/RefundRow.jsx
  • src/components/mui/tables/extra-rows/TotalRow.jsx
  • src/components/mui/tables/extra-rows/index.js
  • src/components/mui/tables/mui-table/index.js
  • src/components/mui/tables/sortable-table/index.js
  • webpack.common.js
💤 Files with no reviewable changes (5)
  • src/components/mui/sortable-table/styles.module.less
  • src/components/mui/editable-table/mui-table-editable.module.less
  • src/components/mui/table/mui-table.js
  • src/components/mui/sortable-table/mui-table-sortable.js
  • src/components/mui/editable-table/mui-table-editable.js
🛑 Comments failed to post (1)
src/components/mui/tables/components/styles.module.less (1)

7-12: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Center the dotted border pseudo-element.

align-self has no effect on an absolutely positioned pseudo-element.

The current border starts at the top. Use top: 50% and transform to center the 60% height border.

Proposed fix
-    top: 0;
-    bottom: 0;
+    top: 50%;
     left: 0;
     border-left: 1px dashed `#e0e0e0`;
     height: 60%;
-    align-self: center;
+    transform: translateY(-50%);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    top: 50%;
    left: 0;
    border-left: 1px dashed `#e0e0e0`;
    height: 60%;
    transform: translateY(-50%);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/mui/tables/components/styles.module.less` around lines 7 - 12,
Center the absolutely positioned border pseudo-element by updating its
positioning declarations: replace the top-zero alignment with top: 50% and apply
a vertical translate matching half its 60% height. Remove the ineffective
align-self declaration while preserving the existing bottom, left, border, and
height styling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant