Skip to content

Commit c0ff835

Browse files
committed
Improve offilen documentation
1 parent 29c4c07 commit c0ff835

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

docs/ReferenceOneField.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,25 +160,24 @@ You can also set the `link` prop to a string, which will be used as the link typ
160160

161161
## `offline`
162162

163-
Use `offline` to customize the text displayed when the related record is empty because there is no network connectivity.
163+
When the user is offline, `<ReferenceOneField>` is smart enough to display the referenced record if it was previously fetched. However, if the referenced record has never been fetched before, `<ReferenceOneField>` displays an error message explaining that the app has lost network connectivity.
164164

165-
```jsx
166-
<ReferenceOneField label="Details" reference="book_details" target="book_id" offline="No network, could not fetch data">
167-
...
168-
</ReferenceOneField>
169-
```
170-
171-
`offline` also accepts a `ReactNode`.
165+
You can customize this error message by passing a React element or a string to the `offline` prop:
172166

173167
```jsx
174168
<ReferenceOneField
175-
label="Details"
176169
reference="book_details"
177170
target="book_id"
178171
offline={<p>No network, could not fetch data</p>}
179172
>
180173
...
181174
</ReferenceOneField>
175+
<ReferenceOneField
176+
reference="book_details"
177+
target="book_id"
178+
offline="No network, could not fetch data">
179+
...
180+
</ReferenceOneField>
182181
```
183182

184183
## `queryOptions`

docs/ReferenceOneFieldBase.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,24 @@ You can also set the `link` prop to a string, which will be used as the link typ
198198

199199
## `offline`
200200

201-
Use `offline` to customize the text displayed when the related record is empty because there is no network connectivity.
201+
When the user is offline, `<ReferenceOneFieldBase>` is smart enough to display the referenced record if it was previously fetched. However, if the referenced record has never been fetched before, `<ReferenceOneFieldBase>` displays an error message explaining that the app has lost network connectivity.
202202

203-
```jsx
204-
<ReferenceOneFieldBase label="Details" reference="book_details" target="book_id" offline="No network, could not fetch data">
205-
...
206-
</ReferenceOneFieldBase>
207-
```
208-
209-
`offline` also accepts a `ReactNode`.
203+
You can customize this error message by passing a React element or a string to the `offline` prop:
210204

211205
```jsx
212206
<ReferenceOneFieldBase
213-
label="Details"
214207
reference="book_details"
215208
target="book_id"
216209
offline={<p>No network, could not fetch data</p>}
217210
>
218211
...
219212
</ReferenceOneFieldBase>
213+
<ReferenceOneFieldBase
214+
reference="book_details"
215+
target="book_id"
216+
offline="No network, could not fetch data">
217+
...
218+
</ReferenceOneFieldBase>
220219
```
221220

222221
## `queryOptions`

0 commit comments

Comments
 (0)