Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
774d65a
remove `ListIterator.tsx` and `ListIterator.md`
erwanMarmelab Aug 4, 2025
3e0466c
remove `ListIterator.spect.tsx` and `ListIterator.stories.tsx`
erwanMarmelab Aug 5, 2025
2707c3d
remove ListIterator export
erwanMarmelab Aug 5, 2025
786f2d1
remove `ListIterator` usage of `SimpleList`
erwanMarmelab Aug 5, 2025
567fcb1
Adapt the SimpleList stories
erwanMarmelab Aug 5, 2025
9432eef
Adapt the ReferenceManyFieldBase story
erwanMarmelab Aug 5, 2025
6c36411
adapt docs
erwanMarmelab Aug 5, 2025
201712e
fix doc
erwanMarmelab Aug 5, 2025
83a583b
fix asynchrone issue in tests
erwanMarmelab Aug 5, 2025
0315067
Update packages/ra-ui-materialui/src/list/SimpleList/SimpleList.tsx
erwanMarmelab Aug 5, 2025
8e8edc2
code review -> fix SimpleList standalone usage with the data prop
erwanMarmelab Aug 5, 2025
0009043
code review -> use ListBase render prop
erwanMarmelab Aug 5, 2025
ac49416
Add a ListIterator alias for WithListcontext
erwanMarmelab Aug 5, 2025
5999871
Update WithListContext to accept optional empty, loading and error co…
erwanMarmelab Aug 5, 2025
94d66df
fix BC
erwanMarmelab Aug 5, 2025
66e9a36
remove useless imports
erwanMarmelab Aug 5, 2025
d898e60
use new props in the doc
erwanMarmelab Aug 5, 2025
827a502
add WithListContext tests
erwanMarmelab Aug 5, 2025
daf0a4d
Document new WithListContext keys
erwanMarmelab Aug 5, 2025
5439b10
Improve new key descriptions
erwanMarmelab Aug 5, 2025
24e8c94
Change WithListContext for standalone usage, add RecordsIterator.
Madeorsk Aug 11, 2025
c7d83c4
Fix WithListContext props order.
Madeorsk Aug 11, 2025
7da0b63
Document standalone usage of WithListContext and fix error element pr…
Madeorsk Aug 11, 2025
7a4dcbd
Improve ReferenceFieldBase doc.
Madeorsk Aug 11, 2025
4a3acde
Improve WithListContext query state components handling, handle offli…
Madeorsk Sep 5, 2025
3789c45
Improve SimpleList default empty component.
Madeorsk Sep 5, 2025
e65c84f
Add a comment regarding standalone usage of SimpleList.
Madeorsk Sep 5, 2025
526bb83
Keep label as allowed WithListContext property.
Madeorsk Sep 5, 2025
6f14613
Update ReferenceArrayFieldBase example with the updated WithListContext.
Madeorsk Sep 5, 2025
acea48f
Add support for children in WithListContext documentation.
Madeorsk Sep 5, 2025
59808d1
Set render prop of WithListContext as optional.
Madeorsk Sep 5, 2025
a086f8c
Improve stories and examples code.
Madeorsk Sep 5, 2025
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
239 changes: 0 additions & 239 deletions docs/ListIterator.md

This file was deleted.

14 changes: 8 additions & 6 deletions docs/ReferenceArrayFieldBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ A typical `post` record therefore looks like this:
In that case, use `<ReferenceArrayFieldBase>` to display the post tag names as a list of chips, as follows:

```jsx
import { ListBase, ListIterator, ReferenceArrayFieldBase } from 'react-admin';
import { ListBase, RecordsIterator, ReferenceArrayFieldBase, WithListContext } from 'react-admin';

export const PostList = () => (
<ListBase>
<ListIterator>
<ReferenceArrayFieldBase reference="tags" source="tag_ids">
<TagList />
</ReferenceArrayFieldBase>
</ListIterator>
<WithListContext loading={null} errorElement={null} offline={null} empty={null}>
<RecordsIterator>
<ReferenceArrayFieldBase reference="tags" source="tag_ids">
<TagList />
</ReferenceArrayFieldBase>
</RecordsIterator>
</WithListContext>
</ListBase>
);

Expand Down
26 changes: 14 additions & 12 deletions docs/ReferenceFieldBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,17 @@ When used in a `<DataTable>`, `<ReferenceFieldBase>` fetches the referenced reco
For instance, with this code:

```jsx
import { ListBase, ListIterator, ReferenceFieldBase } from 'react-admin';
import { ListBase, RecordsIterator, ReferenceFieldBase, WithListContext } from 'react-admin';

export const PostList = () => (
<ListBase>
<ListIterator>
<ReferenceFieldBase source="user_id" reference="users">
<AuthorView />
</ReferenceFieldBase>
</ListIterator>
<WithListContext loading={null} errorElement={null} offline={null} empty={null}>
<RecordsIterator>
<ReferenceFieldBase source="user_id" reference="users">
<AuthorView />
</ReferenceFieldBase>
</RecordsIterator>
</WithListContext>
</ListBase>
);
```
Expand Down Expand Up @@ -270,16 +272,16 @@ For example, the following code prefetches the authors referenced by the posts:
```jsx
const PostList = () => (
<ListBase queryOptions={{ meta: { prefetch: ['author'] } }}>
<ListIterator
render={({ title, author_id }) => (
<WithListContext loading={null} errorElement={null} offline={null} empty={null}>
<RecordsIterator render={(author) => (
<div>
<h3>{title}</h3>
<h3>{author.title}</h3>
<ReferenceFieldBase source="author_id" reference="authors">
<AuthorView />
</ReferenceFieldBase>
</div>
)}
/>
)} />
</WithListContext>
</ListBase>
);
```
Expand All @@ -303,4 +305,4 @@ React-Admin will call `canAccess` with the following parameters:
- If the `users` resource has a Show view: `{ action: "show", resource: 'posts', record: Object }`
- If the `users` resource has an Edit view: `{ action: "edit", resource: 'posts', record: Object }`

And the link property of the referenceField context will be set accordingly. It will be set to false if the access is denied.
And the link property of the referenceField context will be set accordingly. It will be set to false if the access is denied.
47 changes: 32 additions & 15 deletions docs/ReferenceManyFieldBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@ const BookList = ({
You can also use `<ReferenceManyFieldBase>` in a list, e.g. to display the authors of the comments related to each post in a list by matching `post.id` to `comment.post_id`:

```jsx
import { ListBase, ListIterator, ReferenceManyFieldBase } from 'react-admin';
import { ListBase, RecordsIterator, ReferenceManyFieldBase, WithListContext } from 'react-admin';

export const PostList = () => (
<ListBase>
<ListIterator>
<ReferenceManyFieldBase reference="comments" target="post_id">
<CustomAuthorView source="name"/>
</ReferenceManyFieldBase>
</ListIterator>
<WithListContext loading={null} errorElement={null} offline={null} empty={null}>
<RecordsIterator>
<ReferenceManyFieldBase reference="comments" target="post_id">
<CustomAuthorView source="name"/>
</ReferenceManyFieldBase>
</RecordsIterator>
</WithListContext>
</ListBase>
);
```
Expand Down Expand Up @@ -116,20 +118,31 @@ export const PostList = () => (
- [`<EditableDatagrid>`](./EditableDatagrid.md)
- [`<Calendar>`](./Calendar.md)

For instance, use a `<ListIterator>` to render the related records:
For instance, use a `<RecordsIterator>` to render the related records:

```jsx
import { ShowBase, ReferenceManyFieldBase, ListIterator } from 'react-admin';
import { ShowBase, RecordsIterator, ReferenceManyFieldBase } from 'react-admin';

export const AuthorShow = () => (
<ShowBase>
<ReferenceManyFieldBase label="Books" reference="books" target="author_id">
<ReferenceManyFieldBase
label="Books"
reference="books"
target="author_id"
loading={<p>Loading...</p>}
error={null}
offline={null}
empty={null}
>
<ul>
<ListIterator render={(book) => (
<li key={book.id}>
<i>{book.title}</i>, published on{' '}{book.published_at}
</li>
)}/>
<RecordsIterator
render={book => (
<li key={book.id}>
<i>{book.title}</i>, published on
{book.published_at}
</li>
)}
/>
</ul>
</ReferenceManyFieldBase>
</ShowBase>
Expand Down Expand Up @@ -343,8 +356,12 @@ In the example below, both lists use the same reference ('books'), but their sel
queryOptions={{
meta: { foo: 'bar' },
}}
loading={<p>Loading...</p>}
error={null}
offline={null}
empty={<p>No books</p>}
>
<ListIterator render={(book) => (
<RecordsIterator render={(book) => (
<p>{book.title}</p>
)} />
</ReferenceManyFieldBase>
Expand Down
Loading
Loading