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: CHANGELOG.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,24 @@
1
1
# Changelog
2
2
3
+
## 5.10.2
4
+
5
+
* Add warning when using `queryOptions` to add a `meta` in `<Edit>` and `<EditBase>` ([#10882](https://github.com/marmelab/react-admin/pull/10882)) ([Madeorsk](https://github.com/Madeorsk))
6
+
* Fix error when authProvider check methods are not async ([#10890](https://github.com/marmelab/react-admin/pull/10890)) ([fzaninotto](https://github.com/fzaninotto))
7
+
* Fix `ChipField` consider zero to be empty ([#10877](https://github.com/marmelab/react-admin/pull/10877)) ([djhi](https://github.com/djhi))
*[Doc] Add details about Datagrid to DataTable migration ([#10884](https://github.com/marmelab/react-admin/pull/10884)) ([Madeorsk](https://github.com/Madeorsk))
10
+
11
+
## 5.10.1
12
+
13
+
* Fix `<ColumnsButton>` cannot be used with keyboard ([#10869](https://github.com/marmelab/react-admin/pull/10869)) ([djhi](https://github.com/djhi))
* Fix `<ReferenceArrayInput>` does not accept `alwaysOn` prop ([#10863](https://github.com/marmelab/react-admin/pull/10863)) ([djhi](https://github.com/djhi))
16
+
* Fix `DateInput` JSDoc formatting and example ([#10855](https://github.com/marmelab/react-admin/pull/10855)) ([ogroppo](https://github.com/ogroppo))
17
+
* Fix B&W theme label is invisible for inputs with `standard` variant ([#10854](https://github.com/marmelab/react-admin/pull/10854)) ([djhi](https://github.com/djhi))
18
+
* Fix Show and Edit controllers can trigger a redirect loop with react-router v7 if getOne rejects ([#10850](https://github.com/marmelab/react-admin/pull/10850)) ([slax57](https://github.com/slax57))
19
+
*[Demo] Migrate from `fetch-mock` to `msw` ([#10844](https://github.com/marmelab/react-admin/pull/10844)) ([erwanMarmelab](https://github.com/erwanMarmelab))
20
+
* Bump linkifyjs from 4.1.1 to 4.3.2 ([#10868](https://github.com/marmelab/react-admin/pull/10868)) ([dependabot[bot]](https://github.com/apps/dependabot))
21
+
3
22
## 5.10.0
4
23
5
24
* Add filter input to `<ColumnsButton>` when there are many columns ([#10848](https://github.com/marmelab/react-admin/pull/10848)) ([slax57](https://github.com/slax57))
"description": "A frontend Framework for building single-page applications running in the browser on top of REST/GraphQL APIs, using TypeScript, React, react-router, react-hook-form, react-query, and Material Design.",
It's very common that your auth logic is so specific that you'll need to write your own `authProvider`. However, the community has built a few open-source Auth Providers that may fit your need:
- Remove the `optimized` prop (which isn't necessary anymore)
1880
+
- Rename the keys in `sx` prop from `"& .RaDatagrid-xxxx"` to `"& .RaDataTable-xxxx"`.
1881
+
- Replace simple `<TextField>` with `<DataTable.Col>`.
1882
+
- Replace simple `<NumberField>` with `<DataTable.NumberCol>`.
1883
+
- Wrap all other fields in `<DataTable.Col>`, keeping `source` and `label` properties in `<DataTable.Col>`.
1884
+
- Replace `Datagrid` imports by `DataTable`, and remove unused `TextField` and `NumberField` imports if they are now all replaced.
1885
+
1886
+
However, the codemod will **not**:
1887
+
1888
+
- Replace `<DatagridConfigurable>` with `<DataTable>` (column selection is now natively supported by `<DataTable>`).
1889
+
- Remove the `sortBy` and `sortable` props on fields (sorting is now managed by `<DataTable.Col source>`)
1890
+
- Move the `sortByOrder` prop from the field to `<DataTable.Col>`
1891
+
- Replace a `<FunctionField>` child with `<DataTable.Col render>`
1892
+
- Replace `<Datagrid>` from `@react-admin/ra-rbac` (and all its children). Refer to [Access Control section](#access-control) to use `<DataTable>` with `<CanAccess>`.
1893
+
- Move the column styles from `<Datagrid sx>` to the individual `<DataTable.Col sx>`
Copy file name to clipboardExpand all lines: docs/Edit.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -414,6 +414,8 @@ const PostEdit = () => (
414
414
415
415
{% endraw %}
416
416
417
+
**Warning**: If you set `mutationOptions` meta without [redirecting](#redirect), make sure that [`queryOptions`](#queryoptions) meta is the same, or you will have data update issues.
418
+
417
419
You can also use `mutationOptions` to override success or error side effects, by setting the `mutationOptions` prop. Refer to the [useMutation documentation](https://tanstack.com/query/v5/docs/react/reference/useMutation) in the react-query website for a list of the possible options.
418
420
419
421
Let's see an example with the success side effect. By default, when the save action succeeds, react-admin shows a notification, and redirects to the list page. You can override this behavior and pass custom success side effects by providing a `mutationOptions` prop with an `onSuccess` key:
@@ -542,7 +544,7 @@ The default `onError` function is:
542
544
543
545
## `offline`
544
546
545
-
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:
547
+
By default, `<Edit>` renders the `<Offline>` component when there is no connectivity and the record hasn't been cached yet. You can provide your own component via the `offline` prop:
**Warning**: If you set `queryOptions` meta without [redirecting](#redirect), make sure that [`mutationOptions`](#mutationoptions) meta is the same, or you will have data update issues.
600
+
597
601
You can also use `queryOptions` to force a refetch on reconnect:
598
602
599
603
{% raw %}
@@ -629,7 +633,9 @@ const PostEdit = () => (
629
633
);
630
634
```
631
635
632
-
Note that the `redirect` prop is ignored if you set [the `mutationOptions` prop](#mutationoptions). See that prop for how to set a different redirection path in that case.
636
+
Note that the `redirect` prop is ignored if you set an `onSuccess` callback of [the `mutationOptions` prop](#mutationoptions). See that prop for how to set a different redirection path in that case.
637
+
638
+
**Warning**: If you set [`queryOptions`](#queryoptions) meta without redirecting, make sure that [`mutationOptions`](#mutationoptions) meta is the same, or you will have data update issues.
|`offline`| Optional |`ReactNode`|`<Offline>`| The component to render when there is no connectivity and there is no data in the cache |
75
76
|`pagination`| Optional |`ReactElement`|`<Infinite Pagination>`| The pagination component to use. |
76
77
|`perPage`| Optional |`number`|`10`| The number of records to fetch per page. |
77
78
|`queryOptions`| Optional |`object`| - | The options to pass to the `useQuery` hook. |
@@ -85,6 +86,49 @@ Check the [`<List>` component](./List.md) for details about each prop.
85
86
86
87
Additional props are passed down to the root component (a MUI `<Card>` by default).
87
88
89
+
## `offline`
90
+
91
+
By default, `<InfiniteList>` renders the `<Offline>` component when there is no connectivity and there are no records in the cache yet for the current parameters (page, sort, etc.). You can provide your own component via the `offline` prop:
**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:
You can replace the default "load on scroll" pagination (triggered by a component named `<InfinitePagination>`) by a custom pagination component. To get the pagination state and callbacks, you'll need to read the `InfinitePaginationContext`.
By default, `<List>` renders the `<Offline>` component when there is no connectivity and there are no records in the cache yet for the current parameters (page, sort, etc.). You can provide your own component via the `offline` prop:
781
+
782
+
```jsx
783
+
import { List } from'react-admin';
784
+
import { Alert } from'@mui/material';
785
+
786
+
constoffline=<Alert severity="warning">No network. Could not load the posts.</Alert>;
787
+
788
+
exportconstPostList= () => (
789
+
<List offline={offline}>
790
+
...
791
+
</List>
792
+
);
793
+
```
794
+
795
+
**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:
796
+
797
+
```jsx
798
+
import { List, IsOffline } from'react-admin';
799
+
import { Alert } from'@mui/material';
800
+
801
+
constoffline=<Alert severity="warning">No network. Could not load the posts.</Alert>;
802
+
803
+
exportconstPostList= () => (
804
+
<List offline={offline}>
805
+
<IsOffline>
806
+
<Alert severity="warning">
807
+
You are offline, the data may be outdated
808
+
</Alert>
809
+
</IsOffline>
810
+
...
811
+
</List>
812
+
);
813
+
```
814
+
777
815
## `pagination`
778
816
779
817
By default, the `<List>` view displays a set of pagination controls at the bottom of the list.
In addition, `<ListBase>` renders its children components inside a `ListContext`. Check [the `<List children>` documentation](./List.md#children) for usage examples.
0 commit comments