You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use an alternative layout, switch the `<Show>` child component:
159
160
160
161
```diff
162
+
import { Show } from 'react-admin';
163
+
161
164
export const PostShow = () => (
162
165
<Show>
163
166
- <SimpleShowLayout>
@@ -188,6 +191,7 @@ You can override the main area container by passing a `component` prop:
188
191
189
192
{% raw %}
190
193
```jsx
194
+
import { Show } from'react-admin';
191
195
import { Box } from'@mui/material';
192
196
193
197
constShowWrapper= ({ children }) => (
@@ -210,6 +214,8 @@ const PostShow = () => (
210
214
By default, the `<Show>` component will automatically redirect the user to the login page if the user is not authenticated. If you want to disable this behavior and allow anonymous access to a show page, set the `disableAuthentication` prop to `true`.
211
215
212
216
```jsx
217
+
import { Show } from'react-admin';
218
+
213
219
constPostShow= () => (
214
220
<Show disableAuthentication>
215
221
...
@@ -273,6 +279,8 @@ const BookShow = () => (
273
279
By default, `<Show>` deduces the identifier of the record to show from the URL path. So under the `/posts/123/show` path, the `id` prop will be `123`. You may want to force a different identifier. In this case, pass a custom `id` prop.
**Tip**: Pass both a custom `id` and a custom `resource` prop to use `<Show>` independently of the current URL. This even allows you to use more than one `<Show>` component in the same page.
284
292
293
+
## `offline`
294
+
295
+
By default, `<ShowBase>` renders nothing when there is no connectivity and the record hasn't been cached yet. You can provide your own component via the `offline` prop:
296
+
297
+
```jsx
298
+
import { Show } from'react-admin';
299
+
300
+
exportconstPostShow= () => (
301
+
<Show offline={<p>No network. Could not load the post.</p>}>
302
+
...
303
+
</Show>
304
+
);
305
+
```
306
+
307
+
**Tip**: If the record is in the Tanstack Query cache but you want to warn the user that they may see an outdated version, you can use the `<IsOffline>` component:
308
+
309
+
```jsx
310
+
import { Show, IsOffline } from'react-admin';
311
+
312
+
exportconstPostShow= () => (
313
+
<Show offline={<p>No network. Could not load the post.</p>}>
314
+
<IsOffline>
315
+
No network. The post data may be outdated.
316
+
</IsOffline>
317
+
...
318
+
</Show>
319
+
);
320
+
```
321
+
285
322
## `queryOptions`
286
323
287
324
`<Show>` accepts a `queryOptions` prop to pass options to the react-query client.
By default, `<Show>` operates on the current `ResourceContext` (defined at the routing level), so under the `/posts/1/show` path, the `resource` prop will be `posts`. You may want to force a different resource. In this case, pass a custom `resource` prop, and it will override the `ResourceContext` value.
0 commit comments