Skip to content

Commit cafa7b4

Browse files
arminmehweb-flow
authored andcommitted
[DataGridPro] Fix expandable rows detail content height updates (#17394)
1 parent 0ad9941 commit cafa7b4

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
@@ -88,7 +88,6 @@ export const useGridDetailPanel = (
8888
| 'onDetailPanelExpandedRowIdsChange'
8989
>,
9090
): void => {
91-
const expandedRowIds = useGridSelector(apiRef, gridDetailPanelExpandedRowIdsSelector);
9291
const contentCache = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
9392

9493
const handleCellClick = React.useCallback<GridEventListener<'cellClick'>>(
@@ -171,6 +170,7 @@ export const useGridDetailPanel = (
171170
},
172171
};
173172
});
173+
apiRef.current.requestPipeProcessorsApplication('rowHeight');
174174
},
175175
[apiRef],
176176
);
@@ -290,7 +290,8 @@ export const useGridDetailPanel = (
290290

291291
const addDetailHeight = React.useCallback<GridPipeProcessor<'rowHeight'>>(
292292
(initialValue, row) => {
293-
if (!expandedRowIds || expandedRowIds.length === 0 || !expandedRowIds.includes(row.id)) {
293+
const expandedRowIds = gridDetailPanelExpandedRowIdsSelector(apiRef);
294+
if (!expandedRowIds || !expandedRowIds.has(row.id)) {
294295
initialValue.detail = 0;
295296
return initialValue;
296297
}
@@ -302,7 +303,7 @@ export const useGridDetailPanel = (
302303
initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
303304
return initialValue;
304305
},
305-
[apiRef, expandedRowIds, updateCachesIfNeeded],
306+
[apiRef, updateCachesIfNeeded],
306307
);
307308

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

0 commit comments

Comments
 (0)