Skip to content

Commit d9039c0

Browse files
committed
Update documentation
1 parent d416811 commit d9039c0

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

docs/ReferenceField.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,9 @@ You can also use a custom `link` function to get a custom path for the children.
176176

177177
## `offline`
178178

179-
`<ReferenceField>` can display a custom message when the referenced record is missing because there is no network connectivity, thanks to the `offline` prop.
179+
When the user is offline, `<ReferenceField>` is smart enough to display the referenced record if it was previously fetched. However, if the referenced record has never been fetched before, `<ReferenceField>` displays an error message explaining that the app has lost network connectivity.
180180

181-
```jsx
182-
<ReferenceField source="user_id" reference="users" offline="No network, could not fetch data" >
183-
...
184-
</ReferenceField>
185-
```
186-
187-
`<ReferenceField>` renders the `offline` element when:
188-
189-
- the referenced record is missing (no record in the `users` table with the right `user_id`), and
190-
- there is no network connectivity
191-
192-
You can pass either a React element or a string to the `offline` prop:
181+
You can customize this error message by passing a React element or a string to the `offline` prop:
193182

194183
```jsx
195184
<ReferenceField source="user_id" reference="users" offline={<span>No network, could not fetch data</span>} >

docs/ReferenceFieldBase.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,26 +129,15 @@ You can pass either a React element or a string to the `empty` prop:
129129

130130
## `offline`
131131

132-
`<ReferenceFieldBase>` can display a custom message when the referenced record is missing because there is no network connectivity, thanks to the `offline` prop.
132+
When the user is offline, `<ReferenceFieldBase>` is smart enough to display the referenced record if it was previously fetched. However, if the referenced record has never been fetched before, `<ReferenceFieldBase>` displays an error message explaining that the app has lost network connectivity.
133133

134-
```jsx
135-
<ReferenceFieldBase source="user_id" reference="users" offline="No network, could not fetch data" >
136-
...
137-
</ReferenceFieldBase>
138-
```
139-
140-
`<ReferenceFieldBase>` renders the `empty` element when:
141-
142-
- the referenced record is missing (no record in the `users` table with the right `user_id`), and
143-
- there is no network connectivity
144-
145-
You can pass either a React element or a string to the `offline` prop:
134+
You can customize this error message by passing a React element or a string to the `offline` prop:
146135

147136
```jsx
148-
<ReferenceFieldBase source="user_id" reference="users" empty={<span>No network, could not fetch data</span>} >
137+
<ReferenceFieldBase source="user_id" reference="users" offline={<span>No network, could not fetch data</span>} >
149138
...
150139
</ReferenceFieldBase>
151-
<ReferenceFieldBase source="user_id" reference="users" empty="No network, could not fetch data" >
140+
<ReferenceFieldBase source="user_id" reference="users" offline="No network, could not fetch data" >
152141
...
153142
</ReferenceFieldBase>
154143
```

0 commit comments

Comments
 (0)