Skip to content

Commit

Permalink
Loading overlay for the initial load only
Browse files Browse the repository at this point in the history
  • Loading branch information
arminmeh committed Aug 2, 2024
1 parent 951a895 commit 3e7e817
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ export const useGridDataSource = (
return;
}

// with lazy loading, only the initial load should show the loading overlay
const useLoadingIndicator = !isLazyLoaded || apiRef.current.getRowsCount() === 0;
const isLoading = gridRowsLoadingSelector(apiRef);
if (!isLoading) {
if (!isLoading && useLoadingIndicator) {
apiRef.current.setLoading(true);
}

Expand Down Expand Up @@ -147,7 +149,7 @@ export const useGridDataSource = (

const fetchRowBatch = React.useCallback(
(fetchParams: GridGetRowsParams) => {
if (isLazyLoaded && fetchParams.start && fetchParams.end) {
if (isLazyLoaded) {
rowFetchSlice.current = { start: Number(fetchParams.start), end: fetchParams.end };
}
return fetchRows();
Expand Down

0 comments on commit 3e7e817

Please sign in to comment.