Skip to content

[DNM] Remove ListIterator #10880

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

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d333485
remove `ListIterator.tsx` and `ListIterator.md`
erwanMarmelab Aug 4, 2025
8ed2845
remove `ListIterator.spect.tsx` and `ListIterator.stories.tsx`
erwanMarmelab Aug 5, 2025
62a8adf
remove `ListIterator` usage of `SingleFieldList`
erwanMarmelab Aug 5, 2025
339674c
remove ListIterator export
erwanMarmelab Aug 5, 2025
f7d0660
remove `ListIterator` usage of `SimpleList`
erwanMarmelab Aug 5, 2025
a29816e
Adapt the SimpleList stories
erwanMarmelab Aug 5, 2025
25644fa
Adapt the ReferenceManyFieldBase story
erwanMarmelab Aug 5, 2025
7970990
adapt docs
erwanMarmelab Aug 5, 2025
364ce4c
Remove duplicated Stack
erwanMarmelab Aug 5, 2025
29f57f4
fix doc
erwanMarmelab Aug 5, 2025
efd1237
Update packages/ra-ui-materialui/src/list/SimpleList/SimpleList.tsx
erwanMarmelab Aug 5, 2025
835fd62
fix index error
erwanMarmelab Aug 5, 2025
a03318f
fix asynchrone issue in tests
erwanMarmelab Aug 5, 2025
b7098fd
Merge branch 'remox-list-iterator' of github.com:marmelab/react-admin…
erwanMarmelab Aug 5, 2025
1b5b7fb
code review -> fix SimpleList standalone usage with the data prop
erwanMarmelab Aug 5, 2025
ed3c53d
code review -> use ListBase render prop
erwanMarmelab Aug 5, 2025
da27cc4
Add a ListIterator alias for WithListcontext
erwanMarmelab Aug 5, 2025
7cd9254
Update WithListContext to accept optional empty, loading and error co…
erwanMarmelab Aug 5, 2025
38054e3
fix BC
erwanMarmelab Aug 5, 2025
691a075
remove useless imports
erwanMarmelab Aug 5, 2025
5fd2476
use new props in the doc
erwanMarmelab Aug 5, 2025
f847200
add WithListContext tests
erwanMarmelab Aug 5, 2025
62abeea
Document new WithListContext keys
erwanMarmelab Aug 5, 2025
811ccbd
Improve new key descriptions
erwanMarmelab Aug 5, 2025
55ee73b
Change WithListContext for standalone usage, add RecordsIterator.
Madeorsk Aug 11, 2025
c44e43a
Fix WithListContext props order.
Madeorsk Aug 11, 2025
4b20bec
Document standalone usage of WithListContext and fix error element pr…
Madeorsk Aug 11, 2025
5c5f55a
Improve ReferenceFieldBase doc.
Madeorsk Aug 11, 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.

21 changes: 13 additions & 8 deletions docs/ReferenceArrayFieldBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,21 @@ 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, ReferenceArrayFieldBase, RecordsIterator } from 'react-admin';

export const PostList = () => (
<ListBase>
<ListIterator>
<ReferenceArrayFieldBase reference="tags" source="tag_ids">
<TagList />
</ReferenceArrayFieldBase>
</ListIterator>
</ListBase>
<ListBase
Copy link
Member

Choose a reason for hiding this comment

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

This code isn't better than the previous one. It underlines the fact that RecordsIterator should probably return null while loading, without any warning.

render={({ data, isPending }) => (
<>
{!isPending &&
<RecordsIterator data={data}>
<ReferenceArrayFieldBase reference="tags" source="tag_ids">
<TagList />
</ReferenceArrayFieldBase>
</RecordsIterator>
</>
)}
/>
);

const TagList = (props: { children: React.ReactNode }) => {
Expand Down
52 changes: 31 additions & 21 deletions docs/ReferenceFieldBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,21 @@ 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, ReferenceFieldBase, RecordContextProvider } from 'react-admin';

export const PostList = () => (
<ListBase>
<ListIterator>
<ReferenceFieldBase source="user_id" reference="users">
<AuthorView />
</ReferenceFieldBase>
</ListIterator>
</ListBase>
<ListBase
render={({ data, isPending }) => (
<>
{!isPending &&
<RecordsIterator data={data}>
<ReferenceFieldBase source="user_id" reference="users">
<AuthorView />
</ReferenceFieldBase>
</RecordsIterator>
</>
)}
/>
);
```

Expand Down Expand Up @@ -251,18 +256,23 @@ For example, the following code prefetches the authors referenced by the posts:
{% raw %}
```jsx
const PostList = () => (
<ListBase queryOptions={{ meta: { prefetch: ['author'] } }}>
<ListIterator
render={({ title, author_id }) => (
<div>
<h3>{title}</h3>
<ReferenceFieldBase source="author_id" reference="authors">
<AuthorView />
</ReferenceFieldBase>
</div>
)}
/>
</ListBase>
<ListBase
queryOptions={{ meta: { prefetch: ['author'] } }}
render={({ data, isPending }) => (
<>
{!isPending &&
<RecordsIterator render={(author) => (
<div>
<h3>{author.title}</h3>
<ReferenceFieldBase source="author_id" reference="authors">
<AuthorView />
</ReferenceFieldBase>
</div>
)} />
}
</>
)}
/>
);
```
{% endraw %}
Expand All @@ -285,4 +295,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.
Loading
Loading