feat: enable expandable rows for detail panels in flat data #6604
OpenWojakGra(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/6604/headopened - examples/react/mantine-react-table/src/mantine-react-table/hooks/useMRT_TableOptions.ts line 257@@ -251,3 +251,7 @@251251 }252252 : {}),253253 },254+ // v9's `row.toggleExpanded()` is a no-op unless `getCanExpand()` is true,255+ // which by default requires subRows. Every row with a detail panel must be256+ // expandable, even in flat data. A user-supplied `getRowCanExpand` wins.257+ getRowCanExpand: rest.renderDetailPanel ? () => true : undefined,
Sign in to join this conversation.
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough#
The table options hook now enables row expansion for all rows when a detail panel renderer is configured. Otherwise, it sets
getRowCanExpandtoundefined.Changes#
Detail panel expansion
examples/react/mantine-react-table/src/mantine-react-table/hooks/useMRT_TableOptions.tsrenderDetailPanelis set, the hook setsgetRowCanExpandto returntrue, overriding a supplied value. Otherwise, it sets the option toundefined.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Feature
Suggested reviewers:
kevinvandyMerge Risk: 🔵 Low · up to
329f5Rows without subrows whose detail renderer returns no content can still show an active expand control that opens an empty panel. This is a localized UI issue, so the change is mergeable with this follow-up understood.
Architecture Summary#
Architecture risk: 🔵 Low · up to
329f5The change affects 1 system.
Changed systems:
examplesArchitecture concerns No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
useMRT_TableOptionsadds agetRowCanExpandoption that returnstruefor all rows whenrest.renderDetailPanelis set, andundefinedotherwise. Because this field follows the spread ofrestin the returned object, it overrides a user-providedgetRowCanExpandwhen a detail panel is configured.🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 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