Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LG-4881: fix expanded rows with no sub-rows #2714

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/eight-ties-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@leafygreen-ui/table': patch
---

Fix rendering expanded rows with expanded content but no sub-rows
3 changes: 1 addition & 2 deletions packages/table/src/Row/InternalRowWithRT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const InternalRowWithRT = <T extends LGRowData>({

const isExpandable = row.getCanExpand();
const depth = row.depth;
const hasSubRows = row.subRows.length > 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is intentional; check out this chat from another PR. When expanded content is open, the parent row should not be highlighted.

Copy link
Member Author

Choose a reason for hiding this comment

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

It feels strange to me that there is a need to differentiate extended content from sub-rows here. Are there any deeper thoughts to that decision?

It was found as a regression when reviewing my PR upgrading to the latest LG and as it wasn't explicitly called out as a change in the packages/table/UPGRADE.md doc, I assumed this was a bug.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Apologies for not adding it to the upgrade guide. I'll update it. It was missing from the initial implementation, and we caught it during the refactor.


const contextValues = useMemo(() => {
return {
Expand All @@ -53,7 +52,7 @@ const InternalRowWithRT = <T extends LGRowData>({
className={getRowWithRTStyles({
className,
isDisabled: disabled,
isExpanded: (isExpanded && hasSubRows) || isParentExpanded,
isExpanded: isExpanded || isParentExpanded,
isOddVSRow,
isSelected,
isVirtualRow: !!virtualRow,
Expand Down
Loading