-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGridPremium] Fix loading issue + add skeleton overlay #16282
base: master
Are you sure you want to change the base?
Conversation
Deploy preview: https://deploy-preview-16282--material-ui-x.netlify.app/ |
packages/x-data-grid-premium/src/hooks/features/aggregation/createAggregationLookup.ts
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 💯
|
||
const visibleColumns = new Set(Object.keys(rootLookup)); | ||
const viewportHeight = dimensions.bottomContainerHeight ?? 0; | ||
const skeletonRowsCount = Math.ceil(viewportHeight / dimensions.rowHeight); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not always 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I wanted to use this for all the pinned rows in the container, but turned out the pinned rows don't support lazy loading by default, so I made it specific to the aggregation row. We could certainly try limiting it to 1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted a couple of minor things but it looks great 👍
}; | ||
|
||
const GridAggregationRowOverlay = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>( | ||
function GridSkeletonLoadingOverlay(props, forwardedRef) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function GridSkeletonLoadingOverlay(props, forwardedRef) { | |
function GridAggregationRowOverlay(props, forwardedRef) { |
const GridAggregationRowOverlayWrapper = styled('div', { | ||
name: 'MuiDataGrid', | ||
slot: 'AggregationRowOverlayWrapper', | ||
overridesResolver: (_, styles) => styles.aggregationRowOverlayWrapper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overridesResolver: (_, styles) => styles.aggregationRowOverlayWrapper, |
return ( | ||
<div className={clsx(classes.root, gridClasses[`pinnedRows--${position}`])} role="presentation"> | ||
{pinnedRows} | ||
{position === 'bottom' && <GridAggregationRowOverlay />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
export const DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS: GridPremiumSlotsComponent = { | ||
...DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS, | ||
...materialSlots, | ||
columnMenu: GridPremiumColumnMenu, | ||
pinnedRows: GridPinnedRows, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of interest, what's the benefit to this being a slot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just not to spill the logic related to the Premium package in Pro or Community.
Changelog
Fixes [data grid] loading does not work with dataSource in DataGridPremium #16220
Add a skeleton loading overlay on the aggregation row while it's loading for the first time, demo