Skip to content

Commit b4b2f16

Browse files
committed
Merge branch 'master' into merge-master-5.10.2
2 parents 2781033 + 4231cab commit b4b2f16

File tree

72 files changed

+1862
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1862
-647
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

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))
8+
* [Doc] Add Apisix OIDC auth provider ([#10888](https://github.com/marmelab/react-admin/pull/10888)) ([fzaninotto](https://github.com/fzaninotto))
9+
* [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))
14+
* Fix unused imports ([#10866](https://github.com/marmelab/react-admin/pull/10866)) ([Madeorsk](https://github.com/Madeorsk))
15+
* 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+
322
## 5.10.0
423

524
* Add filter input to `<ColumnsButton>` when there are many columns ([#10848](https://github.com/marmelab/react-admin/pull/10848)) ([slax57](https://github.com/slax57))

context7.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://context7.com/schema/context7.json",
3+
"projectTitle": "React-admin",
4+
"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.",
5+
"folders": ["docs"],
6+
"excludeFolders": ["src"],
7+
"excludeFiles": ["*.html","*.js","*.css"],
8+
"previousVersions": [
9+
{
10+
"tag": "v4.16.0",
11+
"title": "version 4.16"
12+
},
13+
{
14+
"tag": "v3.19.0",
15+
"title": "version 3.19"
16+
},
17+
{
18+
"tag": "v2.9.0",
19+
"title": "version 2.9"
20+
}
21+
]
22+
}

docs/AuthProviderList.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ title: "Supported Auth Provider Backends"
88
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:
99

1010
<div class="providers-list" markdown="1">
11+
- ![Apisix logo](./img/backend-logos/apisix.svg "Apisix logo")**[Apache Apisix OIDC](https://apisix.apache.org/)**: [@arte/ra-apisix-oidc](https://www.npmjs.com/package/@arte/ra-apisix-oidc)
1112
- ![Appwrite Logo](./img/backend-logos/appwrite.svg "Appwrite Logo")**[Appwrite](https://appwrite.io/)**: [marmelab/ra-appwrite](https://github.com/marmelab/ra-appwrite)
1213
- ![auth0 Logo](./img/backend-logos/auth0.svg "auth0 Logo")**[Auth0 by Okta](https://auth0.com/)**: [marmelab/ra-auth-auth0](https://github.com/marmelab/ra-auth-auth0/blob/main/packages/ra-auth-auth0/Readme.md)
1314
- ![amplify Logo](./img/backend-logos/amplify.svg "amplify Logo")**[AWS Amplify](https://docs.amplify.aws)**: [MrHertal/react-admin-amplify](https://github.com/MrHertal/react-admin-amplify)

docs/DataTable.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,3 +1871,23 @@ npx jscodeshift ./path/to/src/ \
18711871
--parser=tsx \
18721872
--transform=./node_modules/ra-core/codemods/replace-Datagrid-DataTable.ts
18731873
```
1874+
1875+
Here is what the codemod will transform for you:
1876+
1877+
- Replace `<Datagrid>` with `<DataTable>`.
1878+
- Replace `rowStyle` with `rowSx`.
1879+
- 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>`

docs/Edit.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ const PostEdit = () => (
414414

415415
{% endraw %}
416416

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+
417419
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.
418420

419421
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:
@@ -594,6 +596,8 @@ export const PostEdit = () => (
594596

595597
{% endraw %}
596598

599+
**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+
597601
You can also use `queryOptions` to force a refetch on reconnect:
598602

599603
{% raw %}
@@ -629,7 +633,9 @@ const PostEdit = () => (
629633
);
630634
```
631635

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.
633639

634640
## `render`
635641

docs/ListBase.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ The `<ListBase>` component accepts the following props:
9393
* `render`
9494
* [`resource`](./List.md#resource)
9595
* [`sort`](./List.md#sort)
96+
* [`storeKey`](./List.md#storeKey)
9697
9798
In addition, `<ListBase>` renders its children components inside a `ListContext`. Check [the `<List children>` documentation](./List.md#children) for usage examples.
9899

docs/ReferenceArrayField.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Use `<ReferenceArrayField>` to display a list of related records, via a one-to-m
1010

1111
<iframe src="https://www.youtube-nocookie.com/embed/UeM31-65Wc4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen style="aspect-ratio: 16 / 9;width:100%;margin-bottom:1em;"></iframe>
1212

13-
`<ReferenceArrayField>` fetches a list of referenced records (using the `dataProvider.getMany()` method), and puts them in a [`ListContext`](./useListContext.md). It then renders each related record, using its [`recordRepresentation`](./Resource.md#recordrepresentation), in a [`<ChipField>`](./ChipField.md).
13+
`<ReferenceArrayField>` fetches a list of referenced records (using the `dataProvider.getMany()` method), and puts them in a [`ListContext`](./useListContext.md). It then renders each related record, using its [`recordRepresentation`](./Resource.md#recordrepresentation), in a [`<ChipField>`](./ChipField.md).
1414

1515
**Tip**: If the relationship is materialized by a foreign key on the referenced resource, use [the `<ReferenceManyField>` component](./ReferenceManyField.md) instead.
1616

@@ -101,7 +101,7 @@ You can change how the list of related records is rendered by passing a custom c
101101

102102
## `children`
103103

104-
By default, `<ReferenceArrayField>` renders one string by related record, via a [`<SingleFieldList>`](./SingleFieldList.md) with a [`<ChipField>`](./ChipField.md) using the resource [`recordRepresentation`](./Resource.md#recordrepresentation).
104+
By default, `<ReferenceArrayField>` renders one string by related record, via a [`<SingleFieldList>`](./SingleFieldList.md) with a [`<ChipField>`](./ChipField.md) using the resource [`recordRepresentation`](./Resource.md#recordrepresentation).
105105

106106
![ReferenceArrayField with default children](./img/ReferenceArrayField-default-child.png)
107107

@@ -131,7 +131,7 @@ Is equivalent to:
131131
- [`<SimpleList>`](./SimpleList.md)
132132
- [`<EditableDatagrid>`](./EditableDatagrid.md)
133133
- [`<Calendar>`](./Calendar.md)
134-
- Or a component of your own (check the [`<WithListContext>`](./WithListContext.md) and the [`useListContext`](./useListContext.md) chapters to learn how).
134+
- Or a component of your own (check the [`<WithListContext>`](./WithListContext.md) and the [`useListContext`](./useListContext.md) chapters to learn how).
135135

136136
For instance, use a `<DataTable>` to render the related records in a table:
137137

@@ -188,21 +188,12 @@ export const PostShow = () => (
188188

189189
## `filter`
190190

191-
`<ReferenceArrayField>` fetches all the related records, and displays them all, too. You can use the `filter` prop to filter the list of related records to display (this works by filtering the records client-side, after the fetch).
192-
)} />
193-
<EditButton />
194-
</SimpleShowLayout>
195-
</Show>
196-
);
197-
```
198-
199-
## `filter`
200-
201191
`<ReferenceArrayField>` fetches all the related records, and displays them all, too. You can use the `filter` prop to filter the list of related records to display (this works by filtering the records client-side, after the fetch).
202192

203193
For instance, to render only tags that are 'published', you can use the following code:
204194

205195
{% raw %}
196+
206197
```jsx
207198
<ReferenceArrayField
208199
label="Tags"
@@ -211,6 +202,7 @@ For instance, to render only tags that are 'published', you can use the followin
211202
filter={{ is_published: true }}
212203
/>
213204
```
205+
214206
{% endraw %}
215207

216208
## `label`
@@ -314,9 +306,11 @@ Use the `queryOptions` prop to pass options to [the `dataProvider.getMany()` que
314306
For instance, to pass [a custom `meta`](./Actions.md#meta-parameter):
315307

316308
{% raw %}
309+
317310
```jsx
318311
<ReferenceArrayField queryOptions={{ meta: { foo: 'bar' } }} />
319312
```
313+
320314
{% endraw %}
321315

322316
## `render`
@@ -367,6 +361,7 @@ By default, the related records are displayed in the order in which they appear
367361
For instance, to sort tags by title in ascending order, you can use the following code:
368362

369363
{% raw %}
364+
370365
```jsx
371366
<ReferenceArrayField
372367
label="Tags"
@@ -375,6 +370,7 @@ For instance, to sort tags by title in ascending order, you can use the followin
375370
sort={{ field: 'title', order: 'ASC' }}
376371
/>
377372
```
373+
378374
{% endraw %}
379375

380376
## `sx`: CSS API
@@ -386,4 +382,3 @@ The `<ReferenceArrayField>` component accepts the usual `className` prop. You ca
386382
| `& .RaReferenceArrayField-progress` | Applied to the Material UI's `LinearProgress` component while `isPending` prop is `true` |
387383

388384
To override the style of all instances of `<ReferenceArrayField>` using the [application-wide style overrides](./AppTheme.md#theming-individual-components), use the `RaReferenceArrayField` key.
389-

0 commit comments

Comments
 (0)