Skip to content

Commit 835fd62

Browse files
committed
fix index error
1 parent 29f57f4 commit 835fd62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/ra-ui-materialui/src/list/SingleFieldList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const SingleFieldList = <RecordType extends RaRecord = any>(
9494
render={({ isPending, data }) =>
9595
!isPending && (
9696
<>
97-
{data?.map(record => {
97+
{data?.map((record, index) => {
9898
const resourceLinkPath = !linkType
9999
? false
100100
: createPath({
@@ -107,7 +107,7 @@ export const SingleFieldList = <RecordType extends RaRecord = any>(
107107
return (
108108
<RecordContextProvider
109109
value={record}
110-
key={record.id}
110+
key={record.id || index}
111111
>
112112
<Link
113113
className={
@@ -129,7 +129,7 @@ export const SingleFieldList = <RecordType extends RaRecord = any>(
129129
return (
130130
<RecordContextProvider
131131
value={record}
132-
key={record.id}
132+
key={record.id || index}
133133
>
134134
{children || <DefaultChildComponent />}
135135
</RecordContextProvider>

0 commit comments

Comments
 (0)