Skip to content

Commit 3797ecc

Browse files
committed
Rename errorElement property to error, rename error property to errorState.
1 parent 1dbc38e commit 3797ecc

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

packages/ra-core/src/controller/list/WithListContext.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,20 @@ export const WithListContext = <RecordType extends RaRecord>({
2323
empty,
2424
loading,
2525
offline,
26-
errorElement,
26+
error,
2727
render,
2828
children,
2929
...props
3030
}: WithListContextProps<RecordType>) => {
3131
const context = useListContextWithProps<RecordType>(props);
32-
const { data, total, isPaused, isPending, isPlaceholderData, error } =
33-
context;
32+
const {
33+
data,
34+
total,
35+
isPaused,
36+
isPending,
37+
isPlaceholderData,
38+
error: errorState,
39+
} = context;
3440

3541
if (!isPaused && isPending && loading !== false && loading !== undefined) {
3642
return loading;
@@ -45,8 +51,8 @@ export const WithListContext = <RecordType extends RaRecord>({
4551
return offline;
4652
}
4753

48-
if (error && errorElement !== false && errorElement !== undefined) {
49-
return errorElement;
54+
if (errorState && error !== false && error !== undefined) {
55+
return error;
5056
}
5157

5258
if (
@@ -69,7 +75,7 @@ export interface WithListContextProps<RecordType extends RaRecord>
6975
Partial<
7076
Pick<
7177
ListControllerResult<RecordType>,
72-
'data' | 'total' | 'isPending' | 'error'
78+
'data' | 'total' | 'isPending'
7379
>
7480
>
7581
> {
@@ -78,7 +84,8 @@ export interface WithListContextProps<RecordType extends RaRecord>
7884
) => ReactElement | false | null;
7985
loading?: React.ReactNode;
8086
offline?: React.ReactNode;
81-
errorElement?: React.ReactNode;
87+
errorState?: ListControllerResult<RecordType>['error'];
88+
error?: React.ReactNode;
8289
empty?: React.ReactNode;
8390

8491
/**

0 commit comments

Comments
 (0)