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
* Fix "Deprecated findDOMNode" warning in StrictMode ([6398](https://github.com/marmelab/react-admin/pull/6398)) ([fzaninotto](https://github.com/fzaninotto))
10
+
* Fix `<DateTimeInput>` does not include timezone for initialValue ([6401](https://github.com/marmelab/react-admin/pull/6401)) ([djhi](https://github.com/djhi))
*[Demo] Improve dataProvider logging in GraphQL demo ([6405](https://github.com/marmelab/react-admin/pull/6405)) ([fzaninotto](https://github.com/fzaninotto))
14
+
*[Doc] Add mention of `<RichTextInput>` display bug and userland fix ([6403](https://github.com/marmelab/react-admin/pull/6403)) ([fzaninotto](https://github.com/fzaninotto))
15
+
16
+
## v3.16.4
17
+
18
+
*[Demo] Optimize data loading in e-commerce demo ([6392](https://github.com/marmelab/react-admin/pull/6392)) ([djhi](https://github.com/djhi))
19
+
*[Demo] Fix CRM demo points to bad source file ([6389](https://github.com/marmelab/react-admin/pull/6389)) ([fzaninotto](https://github.com/fzaninotto))
20
+
*[Doc] Fix a typo in main Readme ([6390](https://github.com/marmelab/react-admin/pull/6390)) ([aminetakha](https://github.com/aminetakha))
21
+
*[Doc] Fix incomplete side effect hooks documentation ([6388](https://github.com/marmelab/react-admin/pull/6388)) ([fzaninotto](https://github.com/fzaninotto))
22
+
*[Doc] Fix misleading explanation of `<List syncWithLocation>` prop ([6385](https://github.com/marmelab/react-admin/pull/6385)) ([fzaninotto](https://github.com/fzaninotto))
23
+
*[Doc] Fix `<ListBase>` snippet doesn't explain how to override the title ([6383](https://github.com/marmelab/react-admin/pull/6383)) ([fzaninotto](https://github.com/fzaninotto))
24
+
*[Doc] Fix wrong ending tags in Actions documentation ([6382](https://github.com/marmelab/react-admin/pull/6382)) ([Cornul11](https://github.com/Cornul11))
25
+
3
26
## v3.16.3
4
27
5
28
* Fix `useInput` incorrectly sets default value for numbers ([6374](https://github.com/marmelab/react-admin/pull/6374)) ([djhi](https://github.com/djhi))
Fetching data is called a *side effect*, since it calls the outside world, and is asynchronous. Usual actions may have other side effects, like showing a notification, or redirecting the user to another page. React-admin provides the following hooks to handle most common side effects:
622
622
623
-
-`useNotify`: Return a function to display a notification. The arguments should be a message (it can be a translation key), a level (either `info`, `success` or `warning`), an `options` object to pass to the `translate` function (in the case of the default i18n provider, using Polyglot.js, it will be the interpolation options used for passing variables), a boolean to set to `true` if the notification should contain an "undo" button and a number corresponding to the notification duration.
624
-
-`useRedirect`: Return a function to redirect the user to another page. The arguments should be the path to redirect the user to, and the current `basePath`.
625
-
-`useRefresh`: Return a function to force a rerender of the current view (equivalent to pressing the Refresh button).
626
-
-`useUnselectAll`: Return a function to unselect all lines in the current `Datagrid`. Pass the name of the resource as argument.
623
+
-[`useNotify`](#usenotify): Return a function to display a notification.
624
+
-[`useRedirect`](#useredirect): Return a function to redirect the user to another page.
625
+
-[`useRefresh`](#userefresh): Return a function to force a rerender of the current view (equivalent to pressing the Refresh button).
626
+
-[`useUnselectAll`](#useunselectall): Return a function to unselect all lines in the current `Datagrid`.
627
+
628
+
### `useNotify`
629
+
630
+
This hook returns a function that displays a notification in the bottom of the page.
- the level of the notification (`info`, `success` or `warning` - the default is `info`)
647
+
- an `options` object to pass to the `translate` function (because notificatoin messages are translated if your admin has an `i18nProvider`). It is useful for inserting variables into the translation.
648
+
- an `undoable` boolean. Set it to `true` if the notification should contain an "undo" button
649
+
- a `duration` number. Set it to `0` if the notification should not be dismissable.
**Tip**: When using `useNotify` as a side effect for an `undoable` Edit form, you MUST set the fourth argument to `true`, otherwise the "undo" button will not appear, and the actual update will never occur.
To make this work, react-admin stores a `version` number in its state. The `useDataProvider()` hook uses this `version` in its effect dependencies. Also, page components use the `version` as `key`. The `refresh` callback increases the `version`, which forces a re-execution all queries based on the `useDataProvider()` hook, and a rerender of all components using the `version` as key.
736
+
737
+
This means that you can make any component inside a react-admin app refreshable by using the right key:
738
+
739
+
```jsx
740
+
import*asReactfrom'react';
741
+
import { useVersion } from'react-admin';
742
+
743
+
constMyComponent= () => {
744
+
constversion=useVersion();
745
+
return<div key={version}>
746
+
...
747
+
</div>;
748
+
};
749
+
```
750
+
751
+
The callback takes 1 argument:
752
+
-`hard`: when set to true, the callback empties the cache, too
753
+
754
+
### `useUnselectAll`
755
+
756
+
This hook returns a function that unselects all lines in the current `Datagrid`. Pass the name of the resource as argument.
Copy file name to clipboardexpand all lines: docs/Buttons.md
+65
Original file line number
Diff line number
Diff line change
@@ -345,6 +345,71 @@ To override the style of all instances of `<SkipNavigationButton>` using the [ma
345
345
346
346
### `<MenuItemLink>`
347
347
348
+
The `<MenuItemLink>` component displays a menu item with a label and an icon - or only the icon with a tooltip when the sidebar is minimized. It also handles the automatic closing of the menu on tap on mobile.
|`to`| Required | `string | location` | - | The menu item's target. It is passed to a React Router [NavLink](https://reacttraining.com/react-router/web/api/NavLink) component. |
355
+
|`primaryText`| Required | `string | ReactNode` | - | The menu content, displayed when the menu isn't minimized. |
356
+
|`leftIcon`| Optional |`ReactNode`| - | The menu icon |
357
+
358
+
Additional props are passed down to [the underling material-ui `<MenuItem>` component](https://material-ui.com/api/menu-item/#menuitem-api).
359
+
360
+
You can create a custom menu component using the `<DashboardMenuItem>` and `<MenuItemLink>` components:
See [The theming documentation](./Theming.md#menuitemlink) for more details.
406
+
407
+
**Tip**: If you need a multi-level menu, or a Mega Menu opening panels with custom content, check out [the `ra-navigation`<imgclass="icon"src="./img/premium.svg" /> module](https://marmelab.com/ra-enterprise/modules/ra-navigation) (part of the [Enterprise Edition](https://marmelab.com/ra-enterprise))
`<RichTextInput>` also accepts the [common input props](./Inputs.md#common-input-props).
454
454
455
+
**Tip**: When used inside a material-ui `<Card>` (e.g in the default `<Edit>` view), `<RichTextInput>` displays link tooltip as cut off when the user wants to add a hyperlink to a word located on the left side of the input. This is due to an incompatibility between material-ui's `<Card>` component and Quill's positioning algorithm for the link tooltip.
456
+
457
+
To fix this problem, you should override the default card style, as follows:
458
+
459
+
```diff
460
+
import { Edit, SimpleForm, TextInput } from 'react-admin';
461
+
+import { withStyles } from '@material-ui/core/styles';
0 commit comments