Skip to content

Commit f2a0bfa

Browse files
authored
[DataGridPro] Fix expandable rows detail content height updates (#17394)
1 parent f7b122d commit f2a0bfa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/x-data-grid-pro/src/hooks/features/detailPanel/useGridDetailPanel.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export const useGridDetailPanel = (
8989
| 'onDetailPanelExpandedRowIdsChange'
9090
>,
9191
): void => {
92-
const expandedRowIds = useGridSelector(apiRef, gridDetailPanelExpandedRowIdsSelector);
9392
const contentCache = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
9493

9594
const handleCellClick = React.useCallback<GridEventListener<'cellClick'>>(
@@ -176,6 +175,7 @@ export const useGridDetailPanel = (
176175
},
177176
};
178177
});
178+
apiRef.current.requestPipeProcessorsApplication('rowHeight');
179179
},
180180
[apiRef],
181181
);
@@ -283,7 +283,8 @@ export const useGridDetailPanel = (
283283

284284
const addDetailHeight = React.useCallback<GridPipeProcessor<'rowHeight'>>(
285285
(initialValue, row) => {
286-
if (!expandedRowIds || expandedRowIds.size === 0 || !expandedRowIds.has(row.id)) {
286+
const expandedRowIds = gridDetailPanelExpandedRowIdsSelector(apiRef);
287+
if (!expandedRowIds || !expandedRowIds.has(row.id)) {
287288
initialValue.detail = 0;
288289
return initialValue;
289290
}
@@ -295,7 +296,7 @@ export const useGridDetailPanel = (
295296
initialValue.detail = heightCache[row.id].height ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
296297
return initialValue;
297298
},
298-
[apiRef, expandedRowIds, updateCachesIfNeeded],
299+
[apiRef, updateCachesIfNeeded],
299300
);
300301

301302
const enabled = props.getDetailPanelContent !== undefined;

0 commit comments

Comments
 (0)