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
Copy file name to clipboardExpand all lines: docs/EditBase.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ const BookEdit = () => (
99
99
By default, the `<EditBase>` 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`.
100
100
101
101
```jsx
102
-
import { EditBase } from'ra-core';
102
+
import { EditBase } from'react-admin';
103
103
104
104
constPostEdit= () => (
105
105
<EditBase disableAuthentication>
@@ -113,7 +113,7 @@ const PostEdit = () => (
113
113
By default, `<EditBase>` 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.
By default, `<EditBase>` renders nothing while checking for authentication and permissions. You can provide your own component via the `loading` prop:
130
130
131
131
```jsx
132
-
import { EditBase } from'ra-core';
132
+
import { EditBase } from'react-admin';
133
133
134
134
exportconstPostEdit= () => (
135
135
<EditBase loading={<p>Checking for permissions...</p>}>
@@ -151,6 +151,8 @@ By default, pages using `<EditBase>` use the `undoable` mutation mode. This is p
151
151
You can change this default by setting the `mutationMode` prop - and this affects both the Save and Delete buttons. For instance, to remove the ability to undo the changes, use the `optimistic` mode:
152
152
153
153
```jsx
154
+
import { EditBase } from'react-admin';
155
+
154
156
constPostEdit= () => (
155
157
<EditBase mutationMode="optimistic">
156
158
// ...
@@ -161,6 +163,8 @@ const PostEdit = () => (
161
163
And to make the Save action blocking, and wait for the dataProvider response to continue, use the `pessimistic` mode:
162
164
163
165
```jsx
166
+
import { EditBase } from'react-admin';
167
+
164
168
constPostEdit= () => (
165
169
<EditBase mutationMode="pessimistic">
166
170
// ...
@@ -319,7 +323,7 @@ The default `onError` function is:
319
323
By default, `<EditBase>` 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:
320
324
321
325
```jsx
322
-
import { EditBase } from'ra-core';
326
+
import { EditBase } from'react-admin';
323
327
324
328
exportconstPostEdit= () => (
325
329
<EditBase offline={<p>No network. Could not load the post.</p>}>
**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:
332
336
333
337
```jsx
334
-
import { EditBase, IsOffline } from'ra-core';
338
+
import { EditBase, IsOffline } from'react-admin';
335
339
336
340
exportconstPostEdit= () => (
337
341
<EditBase offline={<p>No network. Could not load the post.</p>}>
@@ -439,7 +443,7 @@ const BookEdit = () => (
439
443
By default, `<EditBase>` 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