Skip to content
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

[DataGrid] Rename ErrorOverlay to GridErrorOverlay #6946

Merged
merged 2 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
"DensityStandardIcon": { "default": "GridTableRowsIcon", "type": { "name": "elementType" } },
"DetailPanelCollapseIcon": { "default": "GridRemoveIcon", "type": { "name": "elementType" } },
"DetailPanelExpandIcon": { "default": "GridAddIcon", "type": { "name": "elementType" } },
"ErrorOverlay": { "default": "ErrorOverlay", "type": { "name": "elementType" } },
"ErrorOverlay": { "default": "GridErrorOverlay", "type": { "name": "elementType" } },
"ExportIcon": { "default": "GridSaveAltIcon", "type": { "name": "elementType" } },
"FilterPanel": { "default": "GridFilterPanel", "type": { "name": "elementType" } },
"FilterPanelDeleteIcon": { "default": "GridCloseIcon", "type": { "name": "elementType" } },
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
"DensityStandardIcon": { "default": "GridTableRowsIcon", "type": { "name": "elementType" } },
"DetailPanelCollapseIcon": { "default": "GridRemoveIcon", "type": { "name": "elementType" } },
"DetailPanelExpandIcon": { "default": "GridAddIcon", "type": { "name": "elementType" } },
"ErrorOverlay": { "default": "ErrorOverlay", "type": { "name": "elementType" } },
"ErrorOverlay": { "default": "GridErrorOverlay", "type": { "name": "elementType" } },
"ExportIcon": { "default": "GridSaveAltIcon", "type": { "name": "elementType" } },
"FilterPanel": { "default": "GridFilterPanel", "type": { "name": "elementType" } },
"FilterPanelDeleteIcon": { "default": "GridCloseIcon", "type": { "name": "elementType" } },
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/data-grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
"DensityStandardIcon": { "default": "GridTableRowsIcon", "type": { "name": "elementType" } },
"DetailPanelCollapseIcon": { "default": "GridRemoveIcon", "type": { "name": "elementType" } },
"DetailPanelExpandIcon": { "default": "GridAddIcon", "type": { "name": "elementType" } },
"ErrorOverlay": { "default": "ErrorOverlay", "type": { "name": "elementType" } },
"ErrorOverlay": { "default": "GridErrorOverlay", "type": { "name": "elementType" } },
"ExportIcon": { "default": "GridSaveAltIcon", "type": { "name": "elementType" } },
"FilterPanel": { "default": "GridFilterPanel", "type": { "name": "elementType" } },
"FilterPanelDeleteIcon": { "default": "GridCloseIcon", "type": { "name": "elementType" } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { GridOverlay, GridOverlayProps } from './containers/GridOverlay';
import { useGridSelector } from '../hooks/utils/useGridSelector';
import { gridDensityRowHeightSelector } from '../hooks/features/density/densitySelector';

export interface ErrorOverlayProps extends GridOverlayProps {
export interface GridErrorOverlayProps extends GridOverlayProps {
error?: Error;
hasError: boolean;
errorInfo: any;
}

// TODO v6: rename to GridErrorOverlay
export const ErrorOverlay = React.forwardRef<HTMLDivElement, ErrorOverlayProps>(
function ErrorOverlay(props: ErrorOverlayProps, ref) {
export const GridErrorOverlay = React.forwardRef<HTMLDivElement, GridErrorOverlayProps>(
function GridErrorOverlay(props, ref) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include the renamed exports in the migration guide

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was not exported previously, only being used in slots, may be export it then?
But as it will be a new export it won't go in migration guide, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, indeed.
No need to export it then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to mention here. The user from #6800 reused the ErrorOverlayProps interface by importing directly this file. I don't think we need update the migration guide but we could add a comment in case he wants to try v6.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the update!

const { error, hasError, errorInfo, ...other } = props;
const apiRef = useGridApiContext();
const defaultLabel = apiRef.current.getLocaleText('errorOverlayDefaultLabel');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const useUtilityClasses = (ownerState: OwnerState) => {
const GridOverlayRoot = styled('div', {
name: 'MuiDataGrid',
slot: 'Overlay',
overridesResolver: (props, styles) => styles.overlay,
overridesResolver: (_, styles) => styles.overlay,
})(({ theme }) => ({
width: '100%',
height: '100%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
GridSearchIcon,
} from '../components';
import { GridColumnUnsortedIcon } from '../components/columnHeaders/GridColumnUnsortedIcon';
import { ErrorOverlay } from '../components/ErrorOverlay';
import { GridErrorOverlay } from '../components/GridErrorOverlay';
import { GridNoResultsOverlay } from '../components/GridNoResultsOverlay';

const DEFAULT_GRID_ICON_SLOTS_COMPONENTS: GridIconSlotsComponent = {
Expand Down Expand Up @@ -92,7 +92,7 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS: GridSlotsComponent = {
SkeletonCell: GridSkeletonCell,
ColumnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
ColumnMenu: GridColumnMenu,
ErrorOverlay,
ErrorOverlay: GridErrorOverlay,
Footer: GridFooter,
Header: GridHeader,
Toolbar: null,
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-data-grid/src/models/gridSlotsComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export interface GridSlotsComponent extends GridIconSlotsComponent {
ColumnMenu: React.JSXElementConstructor<any>;
/**
* Error overlay component rendered above the grid when an error is caught.
* @default ErrorOverlay
* @default GridErrorOverlay
*/
ErrorOverlay: React.JSXElementConstructor<any>;
/**
Expand Down