File tree Expand file tree Collapse file tree 1 file changed +27
-14
lines changed
packages/ra-core/src/controller/field Expand file tree Collapse file tree 1 file changed +27
-14
lines changed Original file line number Diff line number Diff line change 11import * as React from 'react' ;
2+ import { RecordContextProvider } from 'ra-core' ;
23import { QueryClient } from '@tanstack/react-query' ;
34import { CoreAdmin } from '../../core/CoreAdmin' ;
45import { Resource } from '../../core/Resource' ;
56import { ShowBase } from '../../controller/show/ShowBase' ;
67import { TestMemoryRouter } from '../../routing' ;
78import { ReferenceManyFieldBase } from './ReferenceManyFieldBase' ;
8- import { ListBase , ListIterator , useListContext } from '../list' ;
9+ import { ListBase , useListContext , WithListContext } from '../list' ;
910import fakeRestDataProvider from 'ra-data-fakerest' ;
1011
1112export default {
@@ -133,20 +134,32 @@ export const InAList = ({ dataProvider = dataProviderWithAuthorList }) => (
133134 name = "authors"
134135 list = {
135136 < ListBase >
136- < ListIterator
137- render = { author => (
138- < div >
139- < h3 > { author . last_name } Books</ h3 >
140- < ReferenceManyFieldBase
141- target = "author"
142- source = "id"
143- reference = "books"
144- >
145- < AuthorList source = "title" />
146- </ ReferenceManyFieldBase >
147- </ div >
137+ < WithListContext
138+ render = { ( { data, isPending } ) => (
139+ < >
140+ { ! isPending &&
141+ data . map ( author => (
142+ < RecordContextProvider
143+ value = { author }
144+ key = { author . id }
145+ >
146+ < div >
147+ < h3 >
148+ { author . last_name } Books
149+ </ h3 >
150+ < ReferenceManyFieldBase
151+ target = "author"
152+ source = "id"
153+ reference = "books"
154+ >
155+ < AuthorList source = "title" />
156+ </ ReferenceManyFieldBase >
157+ </ div >
158+ </ RecordContextProvider >
159+ ) ) }
160+ </ >
148161 ) }
149- > </ ListIterator >
162+ > </ WithListContext >
150163 </ ListBase >
151164 }
152165 />
You can’t perform that action at this time.
0 commit comments