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/Upgrade.md
+59-59
Original file line number
Diff line number
Diff line change
@@ -423,17 +423,17 @@ Note that `<CustomRoutes>` handles `null` elements and fragments correctly, so y
423
423
}
424
424
```
425
425
426
-
See [https://reactrouter.com/docs/en/v6/upgrading/v5#advantages-of-route-element](https://reactrouter.com/docs/en/v6/upgrading/v5#advantages-of-route-element) for more details about the new `<Route>` element
426
+
See [https://reactrouter.com/en/6.6.2/upgrading/v5#advantages-of-route-element](https://reactrouter.com/en/6.6.2/upgrading/v5#advantages-of-route-element) for more details about the new `<Route>` element
427
427
428
428
### Use `useNavigate` instead of `useHistory`
429
429
430
-
See [https://reactrouter.com/docs/en/v6/upgrading/v5#use-usenavigate-instead-of-usehistory](https://reactrouter.com/docs/en/v6/upgrading/v5#use-usenavigate-instead-of-usehistory) to upgrade.
430
+
See [https://reactrouter.com/en/v6/upgrading/v5#use-usenavigate-instead-of-usehistory](https://reactrouter.com/en/v6/upgrading/v5#use-usenavigate-instead-of-usehistory) to upgrade.
431
431
432
432
### Change The `<Route>` Syntax
433
433
434
434
If your admin contains components that add new sub routes (like react-admin's `<TabbedForm>` and `<TabbedShowLayout>`), you'll need to update the `<Route>` syntax.
435
435
436
-
See [https://reactrouter.com/docs/en/v6/upgrading/v5](https://reactrouter.com/docs/en/v6/upgrading/v5) for details.
436
+
See [https://reactrouter.com/en/v6/upgrading/v5](https://reactrouter.com/en/v6/upgrading/v5) for details.
437
437
438
438
### Using A Custom History
439
439
@@ -1531,7 +1531,7 @@ The same happens for `<Datagrid>`: when used in standalone, it used to accept a
The `<Toolbar>` component used to receive the `width` prop also, that allowed to display the mobile or desktop version depending on its value. This is handle internally in version 4 and you can safely remove this prop.
2017
+
The `<Toolbar>` component used to receive the `width` prop also, that allowed to display the mobile or desktop version depending on its value. This is handled internally in version 4 and you can safely remove this prop.
2018
2018
2019
2019
```diff
2020
2020
import { Toolbar } from 'react-admin';
@@ -2214,14 +2214,14 @@ The `save` function signature no longer takes a redirection side effect as the s
### `<FormContext>`, `<FormContextProvider>` and `useFormContext` Have Been Removed
2240
2240
2241
-
These changes only concerns you if you had custom forms not built with `<FormWithRedirect>`, or custom components relying on the form groups management (accordions or collapsible sections for instance).
2241
+
These changes only concern you if you had custom forms not built with `<FormWithRedirect>`, or custom components relying on the form groups management (accordions or collapsible sections for instance).
2242
2242
2243
2243
As the `save` and `saving` properties are already available through the `<SaveContext>` component and its `useSaveContext` hook, we removed the `<FormContext>`, `<FormContextProvider>` components as well the `useFormContext` hook. The functions around form groups management have been extracted into the `<FormGroupsProvider>` component:
2244
2244
@@ -2285,21 +2285,21 @@ If you had the `redirect` prop set on the `SaveButton`, provide a `onSuccess` pr
2285
2285
2286
2286
```diff
2287
2287
const PostCreateToolbar = props => {
2288
-
+const notify = useNotify();
2289
-
+const redirect = useRedirect();
2288
+
+ const notify = useNotify();
2289
+
+ const redirect = useRedirect();
2290
2290
return (
2291
2291
<Toolbar {...props}>
2292
2292
<SaveButton
2293
2293
label="post.action.save_and_edit"
2294
-
-redirect="edit"
2295
-
+onSuccess={data => {
2296
-
+notify('ra.notification.updated', {
2297
-
+type: 'info',
2298
-
+messageArgs: { smart_count: 1 },
2299
-
+undoable: true,
2300
-
+});
2301
-
+redirect('edit', '/posts', data.id)
2302
-
+}}
2294
+
- redirect="edit"
2295
+
+ onSuccess={data => {
2296
+
+ notify('ra.notification.updated', {
2297
+
+ type: 'info',
2298
+
+ messageArgs: { smart_count: 1 },
2299
+
+ undoable: true,
2300
+
+ });
2301
+
+ redirect('edit', '/posts', data.id)
2302
+
+ }}
2303
2303
/>
2304
2304
</Toolbar>
2305
2305
);
@@ -2403,7 +2403,7 @@ const PostShow = () => (
2403
2403
2404
2404
### `addLabel` Prop No Longer Considered For Show Labelling
2405
2405
2406
-
`<SimpleShowLayout>` and `<TabbedShowLayout>` used to look for an `addLabel` prop to decide whether they needed to add a label or not. this relied on `defaultProps`, which will soon be removed from React.
2406
+
`<SimpleShowLayout>` and `<TabbedShowLayout>` used to look for an `addLabel` prop to decide whether they needed to add a label or not. This relied on `defaultProps`, which will soon be removed from React.
2407
2407
2408
2408
The Show layout components now render a label for their children as soon as they have a `source` or a `label` prop. If you don't want a field to have a label in the show view, pass the `label={false}` prop.
Just like all inputs, `useInput` now only accept `defaultValue` and will ignore `initialValue`.
2496
2496
2497
-
Besides, `useInput` used to return `final-form` properties such as `input` and `meta`. It now returns `field`, `fieldState` and `formState` (see https://react-hook-form.com/api/usecontroller).
2497
+
Besides, `useInput` used to return `final-form` properties such as `input` and `meta`. It now returns `field`, `fieldState` and `formState` (see https://react-hook-form.com/api/usecontroller).
2498
2498
2499
-
Note that the `error` returned by `fieldState` is a not just a simple string anymore but an object with a `message` property.
2499
+
Note that the `error` returned by `fieldState` is not just a simple string anymore but an object with a `message` property.
@@ -2545,7 +2545,7 @@ If you used the `addLabel` prop to hide inputs label by passing `false`, you can
2545
2545
2546
2546
We migrated both the `AutocompleteInput` and `AutocompleteArrayInput` components so that they leverage MUI [`<Autocomplete>`](https://mui.com/components/autocomplete/). If you relied on [Downshift](https://www.downshift-js.com/) options, you'll have to update your component.
2547
2547
2548
-
Besides, some props supported by the previous implementation aren't anymore:
2548
+
Besides, some props aren't available anymore:
2549
2549
-`allowDuplicates`: This is not supported by MUI Autocomplete.
2550
2550
-`clearAlwaysVisible`: the clear button is now always visible, either while hovering the input or when it has focus. You can hide it using the `<Autocomplete>``disableClearable` prop though.
2551
2551
-`resettable`: Removed for the same reason as `clearAlwaysVisible`
@@ -2625,25 +2625,25 @@ import {
2625
2625
const MyRichTextInput = (props) => (
2626
2626
<RichTextInput
2627
2627
{...props}
2628
-
-configureQuill={configureQuill}
2629
-
+toolbar={
2630
-
+<RichTextInputToolbar>
2631
-
+<LevelSelect size={size} />
2632
-
+<FormatButtons size={size} />
2633
-
+<AlignmentButtons {size} />
2634
-
+<ListButtons size={size} />
2635
-
+<LinkButtons size={size} />
2636
-
+<QuoteButtons size={size} />
2637
-
+<ClearButtons size={size} />
2638
-
+<ToggleButton
2639
-
+aria-label="Add a smile"
2640
-
+title="Add a smile"
2641
-
+onClick={() => editor.insertContent(':-)')}
2642
-
+>
2643
-
+<Remove fontSize="inherit" />
2644
-
+</ToggleButton>
2645
-
+</RichTextInputToolbar>
2646
-
}
2628
+
- configureQuill={configureQuill}
2629
+
+ toolbar={
2630
+
+<RichTextInputToolbar>
2631
+
+<LevelSelect size={size} />
2632
+
+<FormatButtons size={size} />
2633
+
+<AlignmentButtons {size} />
2634
+
+<ListButtons size={size} />
2635
+
+<LinkButtons size={size} />
2636
+
+<QuoteButtons size={size} />
2637
+
+<ClearButtons size={size} />
2638
+
+<ToggleButton
2639
+
+aria-label="Add a smile"
2640
+
+title="Add a smile"
2641
+
+onClick={() => editor.insertContent(':-)')}
2642
+
+>
2643
+
+<Remove fontSize="inherit" />
2644
+
+</ToggleButton>
2645
+
+</RichTextInputToolbar>
2646
+
}
2647
2647
/>
2648
2648
}
2649
2649
```
@@ -2699,10 +2699,10 @@ It is now the responsibility of the child input to call the `setFilters` functio
0 commit comments