Skip to content

Commit 4763556

Browse files
committed
Update ShowBase and EditBase authLoading property documentation.
1 parent 1400bbe commit 4763556

File tree

4 files changed

+100
-102
lines changed

4 files changed

+100
-102
lines changed

docs/EditBase.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,32 @@ export const BookEdit = () => (
4444

4545
## Props
4646

47-
| Prop | Required | Type | Default | Description
48-
|------------------|----------|-------------------|---------|--------------------------------------------------------
49-
| `children` | Optional | `ReactNode` | | The components rendering the record fields
50-
| `render` | Optional | `(props: EditControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the EditController context and renders the form
51-
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
52-
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
53-
| `loading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
54-
| `mutationMode` | Optional | `undoable` | | The mutation mode
55-
| `mutationOptions` | Optional | `ReactNode` | | The options to pass to the `useUpdate` hook
56-
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
57-
| `queryOptions` | Optional | `object` | | The options to pass to the `useGetOne` hook
58-
| `transform` | Optional | `string` | | Transform the form data before calling `dataProvider.update()`
47+
| Prop | Required | Type | Default | Description
48+
|--------------------------|----------|----------------------------------------------------------|---------|--------------------------------------------------------
49+
| `authLoading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
50+
| `children` | Optional | `ReactNode` | | The components rendering the record fields
51+
| `render` | Optional | `(props: EditControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the EditController context and renders the form
52+
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
53+
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
54+
| `mutationMode` | Optional | `undoable` | | The mutation mode
55+
| `mutationOptions` | Optional | `ReactNode` | | The options to pass to the `useUpdate` hook
56+
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
57+
| `queryOptions` | Optional | `object` | | The options to pass to the `useGetOne` hook
58+
| `transform` | Optional | `string` | | Transform the form data before calling `dataProvider.update()`
59+
60+
## `authLoading`
61+
62+
By default, `<EditBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `authLoading` prop:
5963

64+
```jsx
65+
import { EditBase } from 'react-admin';
66+
67+
export const PostEdit = () => (
68+
<EditBase authLoading={<p>Checking for permissions...</p>}>
69+
...
70+
</EditBase>
71+
);
72+
```
6073

6174
## `children`
6275

@@ -124,20 +137,6 @@ export const PostEdit = () => (
124137

125138
**Tip**: Pass both a custom `id` and a custom `resource` prop to use `<EditBase>` independently of the current URL. This even allows you to use more than one `<EditBase>` component in the same page.
126139

127-
## `loading`
128-
129-
By default, `<EditBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `loading` prop:
130-
131-
```jsx
132-
import { EditBase } from 'react-admin';
133-
134-
export const PostEdit = () => (
135-
<EditBase loading={<p>Checking for permissions...</p>}>
136-
...
137-
</EditBase>
138-
);
139-
```
140-
141140
## `mutationMode`
142141

143142
The `<EditBase>` component exposes a save method, which perform a "mutation" (i.e. they alter the data). React-admin offers three modes for mutations. The mode determines when the side effects (redirection, notifications, etc.) are executed:

docs/ShowBase.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,30 @@ const App = () => (
6060

6161
## Props
6262

63-
| Prop | Required | Type | Default | Description
64-
|------------------|----------|-------------------|---------|--------------------------------------------------------
65-
| `children` | Optional | `ReactNode` | | The components rendering the record fields
66-
| `render` | Optional | `(props: ShowControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the ShowController context and renders the form
67-
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
68-
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
69-
| `loading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
70-
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
71-
| `queryOptions` | Optional | `object` | | The options to pass to the `useQuery` hook
72-
| `resource` | Optional | `string` | | The resource name, e.g. `posts`
63+
| Prop | Required | Type | Default | Description
64+
|--------------------------|----------|----------------------------------------------------------|---------|--------------------------------------------------------
65+
| `authLoading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
66+
| `children` | Optional | `ReactNode` | | The components rendering the record fields
67+
| `render` | Optional | `(props: ShowControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the ShowController context and renders the form
68+
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
69+
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
70+
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
71+
| `queryOptions` | Optional | `object` | | The options to pass to the `useQuery` hook
72+
| `resource` | Optional | `string` | | The resource name, e.g. `posts`
73+
74+
## `authLoading`
75+
76+
By default, `<ShowBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `authLoading` prop:
77+
78+
```jsx
79+
import { ShowBase } from 'react-admin';
80+
81+
export const PostShow = () => (
82+
<ShowBase authLoading={<p>Checking for permissions...</p>}>
83+
...
84+
</ShowBase>
85+
);
86+
```
7387

7488
## `children`
7589

@@ -138,20 +152,6 @@ export const PostShow = () => (
138152

139153
**Tip**: Pass both a custom `id` and a custom `resource` prop to use `<ShowBase>` independently of the current URL. This even allows you to use more than one `<ShowBase>` component in the same page.
140154

141-
## `loading`
142-
143-
By default, `<ShowBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `loading` prop:
144-
145-
```jsx
146-
import { ShowBase } from 'react-admin';
147-
148-
export const PostShow = () => (
149-
<ShowBase loading={<p>Checking for permissions...</p>}>
150-
...
151-
</ShowBase>
152-
);
153-
```
154-
155155
## `offline`
156156

157157
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:

docs_headless/src/content/docs/EditBase.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,34 @@ export const BookEdit = () => (
3838

3939
## Props
4040

41-
| Prop | Required | Type | Default | Description
42-
|------------------|----------|-------------------|---------|--------------------------------------------------------
43-
| `children` | Optional | `ReactNode` | | The components rendering the record fields
44-
| `render` | Optional | `(props: EditControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the EditController context and renders the form
45-
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
46-
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
47-
| `loading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
48-
| `mutationMode` | Optional | `undoable` | | The mutation mode
49-
| `mutationOptions` | Optional | `ReactNode` | | The options to pass to the `useUpdate` hook
50-
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
51-
| `queryOptions` | Optional | `object` | | The options to pass to the `useGetOne` hook
52-
| `transform` | Optional | `string` | | Transform the form data before calling `dataProvider.update()`
41+
| Prop | Required | Type | Default | Description
42+
|--------------------------|----------|----------------------------------------------------------|---------|--------------------------------------------------------
43+
| `authLoading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
44+
| `children` | Optional | `ReactNode` | | The components rendering the record fields
45+
| `render` | Optional | `(props: EditControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the EditController context and renders the form
46+
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
47+
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
48+
| `mutationMode` | Optional | `undoable` | | The mutation mode
49+
| `mutationOptions` | Optional | `ReactNode` | | The options to pass to the `useUpdate` hook
50+
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
51+
| `queryOptions` | Optional | `object` | | The options to pass to the `useGetOne` hook
52+
| `transform` | Optional | `string` | | Transform the form data before calling `dataProvider.update()`
53+
54+
## `authLoading`
55+
56+
By default, `<EditBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `authLoading` prop:
5357

58+
```jsx
59+
import { EditBase, Form } from 'ra-core';
60+
61+
export const PostEdit = () => (
62+
<EditBase authLoading={<p>Checking for permissions...</p>}>
63+
<Form>
64+
{/* form content */}
65+
</Form>
66+
</EditBase>
67+
);
68+
```
5469

5570
## `children`
5671

@@ -117,22 +132,6 @@ export const PostEdit = () => (
117132

118133
**Tip**: Pass both a custom `id` and a custom `resource` prop to use `<EditBase>` independently of the current URL. This even allows you to use more than one `<EditBase>` component in the same page.
119134

120-
## `loading`
121-
122-
By default, `<EditBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `loading` prop:
123-
124-
```jsx
125-
import { EditBase, Form } from 'ra-core';
126-
127-
export const PostEdit = () => (
128-
<EditBase loading={<p>Checking for permissions...</p>}>
129-
<Form>
130-
{/* form content */}
131-
</Form>
132-
</EditBase>
133-
);
134-
```
135-
136135
## `mutationMode`
137136

138137
The `<EditBase>` component exposes a save method, which perform a "mutation" (i.e. they alter the data). Ra-core offers three modes for mutations. The mode determines when the side effects (redirection, notifications, etc.) are executed:

docs_headless/src/content/docs/ShowBase.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,30 @@ const App = () => (
5656

5757
## Props
5858

59-
| Prop | Required | Type | Default | Description
60-
|------------------|----------|-------------------|---------|--------------------------------------------------------
61-
| `children` | Optional | `ReactNode` | | The components rendering the record fields
62-
| `render` | Optional | `(props: ShowControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the ShowController context and renders the form
63-
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
64-
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
65-
| `loading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
66-
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
67-
| `queryOptions` | Optional | `object` | | The options to pass to the `useQuery` hook
68-
| `resource` | Optional | `string` | | The resource name, e.g. `posts`
59+
| Prop | Required | Type | Default | Description
60+
|--------------------------|----------|----------------------------------------------------------|---------|--------------------------------------------------------
61+
| `authLoading` | Optional | `ReactNode` | | The component to render while checking for authentication and permissions
62+
| `children` | Optional | `ReactNode` | | The components rendering the record fields
63+
| `render` | Optional | `(props: ShowControllerResult<RecordType>) => ReactNode` | | Alternative to children, a function that takes the ShowController context and renders the form
64+
| `disable Authentication` | Optional | `boolean` | | Set to `true` to disable the authentication check
65+
| `id` | Optional | `string` | | The record identifier. If not provided, it will be deduced from the URL
66+
| `offline` | Optional | `ReactNode` | | The component to render when there is no connectivity and the record isn't in the cache
67+
| `queryOptions` | Optional | `object` | | The options to pass to the `useQuery` hook
68+
| `resource` | Optional | `string` | | The resource name, e.g. `posts`
69+
70+
## `authLoading`
71+
72+
By default, `<ShowBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `authLoading` prop:
73+
74+
```jsx
75+
import { ShowBase } from 'ra-core';
76+
77+
export const PostShow = () => (
78+
<ShowBase authLoading={<p>Checking for permissions...</p>}>
79+
...
80+
</ShowBase>
81+
);
82+
```
6983

7084
## `children`
7185

@@ -138,20 +152,6 @@ export const PostShow = () => (
138152

139153
**Tip**: Pass both a custom `id` and a custom `resource` prop to use `<ShowBase>` independently of the current URL. This even allows you to use more than one `<ShowBase>` component in the same page.
140154

141-
## `loading`
142-
143-
By default, `<ShowBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `loading` prop:
144-
145-
```jsx
146-
import { ShowBase } from 'ra-core';
147-
148-
export const PostShow = () => (
149-
<ShowBase loading={<p>Checking for permissions...</p>}>
150-
...
151-
</ShowBase>
152-
);
153-
```
154-
155155
## `offline`
156156

157157
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:

0 commit comments

Comments
 (0)