Steps to reproduce
Steps:
- Create a DataGrid with a
dataSource, treeData, lazyLoading and defaultGroupingExpansionDepth={-1}.
- Have a dataset of 5 parents with 2 child rows each (Only 1 level deep) so that 5 groups try to load children on initial render with multiple inflight queries. May require minimal network latency.
- Observe not all child group fetches complete leaving some flashing as skeletons. Network requests complete, grid doesn't render them.
Current behavior
Observe not all child group fetches complete leaving some flashing as skeletons.
Expected behavior
All child groups should load.
Context
I've patched useGridDataSourceBase.js locally and it appears to resolve the issue. It's a claude fix however, so may not be correct but hopefully may help.
Suggested fix
Check the cache before clearing. The clear only needs to happen if we're actually going to make a network round-trip:
if (parentId && parentId !== GRID_ROOT_GROUP_ID && props.signature !== 'DataGrid') {
options.fetchRowChildren?.([parentId], [fetchParams], showChildrenLoading);
return;
}
- options.clearDataSourceState?.();
const cacheKeys = cacheChunkManager.getCacheKeys(fetchParams);
const responses = cacheKeys.map(cacheKey => cache.get(cacheKey));
if (!skipCache && responses.every(response => response !== undefined)) {
lastRequestId.current += 1;
apiRef.current.applyStrategyProcessor('dataSourceRootRowsUpdate', { ... });
if (standardRowsUpdateStrategyActive) apiRef.current.setLoading(false);
return;
}
+ options.clearDataSourceState?.();
Your environment
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
Search keywords: lazyLoading defaultGroupingExpansionDepth
Order ID: 45466
Steps to reproduce
Steps:
dataSource,treeData,lazyLoadinganddefaultGroupingExpansionDepth={-1}.Current behavior
Observe not all child group fetches complete leaving some flashing as skeletons.
Expected behavior
All child groups should load.
Context
I've patched
useGridDataSourceBase.jslocally and it appears to resolve the issue. It's a claude fix however, so may not be correct but hopefully may help.Your environment
npx @mui/envinfoSearch keywords: lazyLoading defaultGroupingExpansionDepth
Order ID: 45466