Skip to content

Commit f1f42cd

Browse files
committed
Improve RecordsIterator docs.
1 parent a9703bd commit f1f42cd

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

docs/RecordsIterator.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ const MostVisitedPosts = () => (
2121
resource="posts"
2222
sort={{ field: 'views', order: 'DESC' }}
2323
perPage={20}
24-
emptyWhileLoading
2524
>
2625
<ul>
2726
<RecordsIterator
2827
render={record => <li>{record.title} - {record.views}</li>}
2928
/>
3029
</ul>
31-
32-
<WithListContext error={<div>Error loading list</div>} />
3330
</ListBase>
3431
);
3532
```
@@ -40,7 +37,6 @@ You can use `<RecordsIterator>` as a child of any component that provides a [`Li
4037
- [`<ReferenceManyField>`](./ReferenceManyField.md),
4138
- [`<ReferenceArrayField>`](./ReferenceArrayField.md),
4239
- [`<List>`](./List.md),
43-
- [`<ListGuesser>`](./ListGuesser.md),
4440
- [`<ListBase>`](./ListBase.md)
4541

4642
```jsx
@@ -49,21 +45,21 @@ import {
4945
ShowBase,
5046
RecordsIterator,
5147
ReferenceManyField,
52-
SingleFieldList
48+
RecordsIterator
5349
} from 'react-admin';
5450

5551
const PostShow = () => (
5652
<ShowBase>
5753
<ReferenceManyField reference="tags" target="post_id">
58-
<SingleFieldList>
54+
<RecordsIterator>
5955
<ChipField source="name" />
60-
</SingleFieldList>
56+
</RecordsIterator>
6157
</ReferenceManyField>
6258
</ShowBase>
6359
);
6460
```
6561

66-
`<RecordsIterator>` expects that data is properly loaded, without error. If you want to handle loading, error, offline and empty states, use related props on the component providing you the list context (like [`<List loading>`](./List.md), [`<ReferenceArrayField loading>`](./ReferenceArrayField.md), [`<ReferenceManyField loading>`](./ReferenceManyField.md)). You can also make use of [`<WithListContext>`](./WithListContext.md) [`loading`](./WithListContext.md#loading), [`error`](./WithListContext.md#error), [`offline`](./WithListContext.md#offline) and [`empty`](./WithListContext.md#empty) props.
62+
`<RecordsIterator>` expects that data is properly loaded, without error. If you want to handle loading, error, offline and empty states, use related props on the component providing you the list context (like [`<List loading>`](./List.md), [`<ListBase loading>`](./ListBase.md), [`<ReferenceArrayField loading>`](./ReferenceArrayField.md), [`<ReferenceManyField loading>`](./ReferenceManyField.md)). You can also make use of [`<WithListContext>`](./WithListContext.md) [`loading`](./WithListContext.md#loading), [`error`](./WithListContext.md#error), [`offline`](./WithListContext.md#offline) and [`empty`](./WithListContext.md#empty) props.
6763

6864
{% raw %}
6965
```jsx

docs_headless/src/content/docs/RecordsIterator.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ const MostVisitedPosts = () => (
1717
resource="posts"
1818
sort={{ field: 'views', order: 'DESC' }}
1919
perPage={20}
20-
emptyWhileLoading
2120
>
2221
<ul>
2322
<RecordsIterator
2423
render={record => <li>{record.title} - {record.views}</li>}
2524
/>
2625
</ul>
27-
28-
<WithListContext error={<div>Error loading list</div>} />
2926
</ListBase>
3027
);
3128
```

0 commit comments

Comments
 (0)