fix(mantine-react-table): don't render a detail panel for the empty row #6598
Opennazaiva(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/6598/headopened - examples/react/mantine-react-table/src/mantine-react-table/components/body/MRT_TableBodyRow.tsx lines 241 to 253@@ -242,8 +241,13 @@242- renderedRowIndex={renderedRowIndex}243- row={row}244- rowVirtualizer={rowVirtualizer}245- striped={striped}246- table={table}247- virtualRow={virtualRow}248- />249- )}241+ {renderDetailPanel &&242+ !row.getIsGrouped() &&243+ row.id !== MRT_EMPTY_ROW_ID && (244+ <MRT_TableDetailPanel245+ parentRowRef={rowRef}246+ renderedRowIndex={renderedRowIndex}247+ row={row}248+ rowVirtualizer={rowVirtualizer}249+ striped={striped}250+ table={table}251+ virtualRow={virtualRow}252+ />253+ )}
Sign in to join this conversation.
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough#
The empty row uses a shared ID constant and renders fallback content in a full-width cell. Detail-panel rendering now skips rows with that ID.
Changes#
Empty row detail-panel handling
examples/react/mantine-react-table/src/mantine-react-table/components/body/MRT_TableBodyRow.tsxMRT_EMPTY_ROW_IDconstant and excludes rows with that ID from detail-panel rendering.examples/react/mantine-react-table/src/mantine-react-table/components/body/MRT_TableBodyEmptyRow.tsxMRT_EMPTY_ROW_IDand renders fallback content or localized text in one full-width cell. Removes the detail-panel expand-button cell.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: 🔵 Low · up to
01e5cA table using the custom ID
mrt-row-emptywill omit that row’s detail panel. The impact is limited and avoidable, but the sentinel collision should be addressed.🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
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