Skip to content

Commit 31f2c0c

Browse files
committed
Merge branch 'master' into next
2 parents 33aef90 + beb7e84 commit 31f2c0c

File tree

113 files changed

+2008
-1153
lines changed

Some content is hidden

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

113 files changed

+2008
-1153
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -166,43 +166,6 @@ jobs:
166166
- name: Build crm
167167
run: make build-crm
168168

169-
greenframe:
170-
runs-on: ubuntu-latest
171-
name: GreenFrame
172-
needs: [e-commerce]
173-
if: github.event_name == 'push' && github.ref_type == 'tag' && contains(github.ref, 'refs/tags/v') && !contains('beta', github.ref) && !contains('alpha', github.ref)
174-
steps:
175-
# To use this repository's private action,
176-
# you must check out the repository
177-
- name: Checkout
178-
uses: actions/checkout@v4
179-
with:
180-
fetch-depth: 2 # Fetch HEAD^ to enable git comparison
181-
- name: Use Node.js LTS
182-
uses: actions/setup-node@v4
183-
with:
184-
node-version: '22.x'
185-
cache: 'yarn'
186-
- name: Install dependencies
187-
run: yarn
188-
- name: Download demo build
189-
uses: actions/download-artifact@v4
190-
with:
191-
name: demo-build
192-
- name: Unzip demo build
193-
run: unzip -o -u demo-build.zip
194-
- name: Run e-commerce
195-
# Run the demo in production mode
196-
run: cd ./examples/demo/dist && python3 -m http.server 4173 &
197-
- name: Install GreenFrame CLI
198-
run: curl https://assets.greenframe.io/install.sh | bash
199-
shell: bash
200-
- name: Run GreenFrame Analysis
201-
env:
202-
GREENFRAME_SECRET_TOKEN: ${{secrets.GREENFRAME_SECRET_TOKEN}}
203-
run: greenframe analyze -C .greenframe.yml --branchName master
204-
shell: bash
205-
206169
create-react-admin:
207170
runs-on: ubuntu-latest
208171
name: create-react-admin

CHANGELOG.md

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

3+
## 5.8.3
4+
5+
* Fix potential prototype-polluting assignment in `ra-data-local-storage` ([#10758](https://github.com/marmelab/react-admin/pull/10758)) ([fzaninotto](https://github.com/fzaninotto))
6+
* [Doc] Document that `optionValue` only works with the `choices` prop ([#10760](https://github.com/marmelab/react-admin/pull/10760)) ([slax57](https://github.com/slax57))
7+
* [Doc] Fix typo in `<SelectInput>` disabled choice example ([#10753](https://github.com/marmelab/react-admin/pull/10753)) ([notz](https://github.com/notz))
8+
* [Doc] Fix create-react-admin instructions when using yarn ([#10752](https://github.com/marmelab/react-admin/pull/10752)) ([erwanMarmelab](https://github.com/erwanMarmelab))
9+
* [Doc] Update `<AutoPersistInStore>` implementation explanation ([#10751](https://github.com/marmelab/react-admin/pull/10751)) ([erwanMarmelab](https://github.com/erwanMarmelab))
10+
* [Doc] Add a new third-party component `huyanhvn/react-admin-clipboard-field` ([#10736](https://github.com/marmelab/react-admin/pull/10736)) ([huyanhvn](https://github.com/huyanhvn))
11+
12+
## 5.8.2
13+
14+
* Fix `<AutocompleteInput>` with `optionValue` and create raises a React warning ([#10747](https://github.com/marmelab/react-admin/pull/10747)) ([slax57](https://github.com/slax57))
15+
* Fix `useInfiniteListController` does not return response `meta` ([#10746](https://github.com/marmelab/react-admin/pull/10746)) ([slax57](https://github.com/slax57))
16+
* Fix `create-react-admin --help` does not show help consistently ([#10744](https://github.com/marmelab/react-admin/pull/10744)) ([erwanMarmelab](https://github.com/erwanMarmelab))
17+
* Fix compatibility of unit tests with react-hook-form 7.56.x ([#10742](https://github.com/marmelab/react-admin/pull/10742)) ([slax57](https://github.com/slax57))
18+
* Fix outlined inputs when label is false ([#10740](https://github.com/marmelab/react-admin/pull/10740)) ([fzaninotto](https://github.com/fzaninotto))
19+
* Fix `<SelectArrayInput>` sanitizes unused props ([#10739](https://github.com/marmelab/react-admin/pull/10739)) ([ghadabezine](https://github.com/ghadabezine))
20+
* Fix `Arrayinput` multiple reset ([#10716](https://github.com/marmelab/react-admin/pull/10716)) ([erwanMarmelab](https://github.com/erwanMarmelab))
21+
* Fix MUI7 compatibility by not using deprecated system props ([#10680](https://github.com/marmelab/react-admin/pull/10680)) ([smeng9](https://github.com/smeng9))
22+
* [Doc] Fix remaining `<AutocompleteArrayInput>` and `<SelectArrayInput>` `create` examples ([#10741](https://github.com/marmelab/react-admin/pull/10741)) ([slax57](https://github.com/slax57))
23+
* [Doc] Document how to pass extra options to create-react-admin when using npm create ([#10737](https://github.com/marmelab/react-admin/pull/10737)) ([slax57](https://github.com/slax57))
24+
* [tips] Backport last AgGrid tips ([#10731](https://github.com/marmelab/react-admin/pull/10731)) ([erwanMarmelab](https://github.com/erwanMarmelab))
25+
26+
## 5.8.1
27+
28+
* Fix `<Confirm>` ignore simple string `title` and `content` props ([#10723](https://github.com/marmelab/react-admin/pull/10723)) ([djhi](https://github.com/djhi))
29+
* Fix `<AutocompleteInput>` and `<SelectInput>` renders undefined instead of the `createLabel` when `optionText` is a function or a `recordRepresentation` is set ([#10715](https://github.com/marmelab/react-admin/pull/10715)) ([slax57](https://github.com/slax57))
30+
* [Doc] Fix documentation build ([#10730](https://github.com/marmelab/react-admin/pull/10730)) ([djhi](https://github.com/djhi))
31+
* [Doc] Fix documentation deployment for previous versions navigation ([#10725](https://github.com/marmelab/react-admin/pull/10725)) ([djhi](https://github.com/djhi))
32+
* [DOC] Rewrite select array input create doc ([#10711](https://github.com/marmelab/react-admin/pull/10711)) ([Cimanel](https://github.com/Cimanel))
33+
* [DOC] selectInput create example + storie ([#10710](https://github.com/marmelab/react-admin/pull/10710)) ([Cimanel](https://github.com/Cimanel))
34+
* [Demo] Fix theme switching ([#10732](https://github.com/marmelab/react-admin/pull/10732)) ([djhi](https://github.com/djhi))
35+
* [chore] Upgrade vite ([#10660](https://github.com/marmelab/react-admin/pull/10660)) ([djhi](https://github.com/djhi))
36+
* Bump vite from 6.2.6 to 6.2.7 ([#10726](https://github.com/marmelab/react-admin/pull/10726)) ([dependabot[bot]](https://github.com/apps/dependabot))
37+
338
## 5.8.0
439

540
* Add `<InPlaceEditor>` for edit-in-place ([#10690](https://github.com/marmelab/react-admin/pull/10690)) ([fzaninotto](https://github.com/fzaninotto))

docs/AutoPersistInStore.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ title: "The AutoPersistInStore Component"
55

66
# `<AutoPersistInStore>`
77

8-
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component prevents data loss in forms by automatically saving the form data in the store when users navigate away from the page. When users return to the page, it reapplies the saved data to the form.
8+
This [Enterprise Edition](https://react-admin-ee.marmelab.com)<img class="icon" src="./img/premium.svg" alt="React Admin Enterprise Edition icon" /> component prevents data loss in forms by automatically saving the form data in the store when users update it. When users return to the page, it reapplies the saved data to the form.
99

1010
<video controls autoplay playsinline muted loop>
1111
<source src="./img/AutoPersistInStore.mp4" type="video/mp4"/>
1212
Your browser does not support the video tag.
1313
</video>
1414

15-
The temporary form data is only saved when the user navigates away from the page, and it is removed when the user submits the form or closes the tab. Users can opt out of the prefilling by clicking the "Cancel" button in the notification.
15+
The temporary form data is saved on change, and it is removed when the user submits the form or closes the tab. Users can opt out of the prefilling by clicking the "Cancel" button in the notification.
1616

17-
Saved data is not sent to the server. It is only persisted using the [store](./Store.md) and is removed when the user logs out.
17+
Saved data is not sent to the server. It is only persisted using the [store](./Store.md) and is removed when the user logs out.
1818

1919
## Usage
2020

@@ -35,15 +35,15 @@ const PostEdit = () => (
3535
);
3636
```
3737

38-
The component will automatically save the form data in the store on unmount and reapply it when the form is mounted again.
38+
The component will automatically save the form data in the store on change and reapply it when the form is mounted again.
3939

4040
It works both on create and edit forms.
4141

4242
## Props
4343

44-
| Prop | Required | Type | Default | Description |
45-
| --------------------- | -------- | ---------- | -------------------------------------------------------- | ------------------------------------------------------------- |
46-
| `getStoreKey` | - | `function` | - | Function to use your own store key. |
44+
| Prop | Required | Type | Default | Description |
45+
| --------------------- | -------- | ---------- | -------------------------------------------------------- | --------------------------------------------------------------------- |
46+
| `getStoreKey` | - | `function` | - | Function to use your own store key. |
4747
| `notificationMessage` | - | `string` | "Applied previous unsaved changes" | Notification message to inform users that their previously saved changes have been applied. |
4848

4949
## `getStoreKey`
@@ -68,10 +68,9 @@ You can override this key by passing a custom function as the `getStoreKey` prop
6868
/>
6969
```
7070

71-
7271
## `notificationMessage`
7372

74-
When `<AutoPersistInStore>` component applies the changes from the store to a form, react-admin informs users with a notification.
73+
When `<AutoPersistInStore>` component applies the changes from the store to a form, react-admin informs users with a notification.
7574

7675
The default notification message is `ra-form-layout.auto_persist_in_store.applied_changes`, which is translated using the i18n provider (the default English translation is `Applied previous unsaved changes`).
7776

docs/AutocompleteArrayInput.md

Lines changed: 52 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -147,65 +147,68 @@ To allow users to add new options, pass a React element as the `create` prop. `<
147147

148148
{% raw %}
149149
```jsx
150-
import { CreateRole } from './CreateRole';
151-
152-
const choices = [
153-
{ id: 'admin', name: 'Admin' },
154-
{ id: 'u001', name: 'Editor' },
155-
{ id: 'u002', name: 'Moderator' },
156-
{ id: 'u003', name: 'Reviewer' },
157-
];
150+
import {
151+
AutocompleteArrayInput,
152+
Create,
153+
CreateBase,
154+
ReferenceArrayInput,
155+
SimpleForm,
156+
TextInput,
157+
useCreateSuggestionContext
158+
} from 'react-admin';
159+
import CloseIcon from '@mui/icons-material/Close';
160+
import {
161+
Dialog,
162+
DialogContent,
163+
DialogTitle,
164+
IconButton,
165+
} from '@mui/material';
158166

159167
const UserCreate = () => (
160168
<Create>
161169
<SimpleForm>
162-
<AutocompleteArrayInput
163-
source="roles"
164-
choices={choices}
165-
create={<CreateRole />}
166-
/>
170+
<ReferenceArrayInput source="roles" reference="roles">
171+
<AutocompleteArrayInput create={<CreateRole />} />
172+
</ReferenceArrayInput>
167173
</SimpleForm>
168174
</Create>
169175
);
170176

171-
// in ./CreateRole.js
172-
import { useCreateSuggestionContext } from 'react-admin';
173-
import {
174-
Button,
175-
Dialog,
176-
DialogActions,
177-
DialogContent,
178-
TextField,
179-
} from '@mui/material';
180-
181177
const CreateRole = () => {
182178
const { filter, onCancel, onCreate } = useCreateSuggestionContext();
183-
const [value, setValue] = React.useState(filter || '');
184-
185-
const handleSubmit = event => {
186-
event.preventDefault();
187-
const newOption = { id: value, name: value };
188-
choices.push(newOption);
189-
setValue('');
190-
onCreate(newOption);
191-
};
192179

193180
return (
194181
<Dialog open onClose={onCancel}>
195-
<form onSubmit={handleSubmit}>
196-
<DialogContent>
197-
<TextField
198-
label="Role name"
199-
value={value}
200-
onChange={event => setValue(event.target.value)}
201-
autoFocus
202-
/>
203-
</DialogContent>
204-
<DialogActions>
205-
<Button type="submit">Save</Button>
206-
<Button onClick={onCancel}>Cancel</Button>
207-
</DialogActions>
208-
</form>
182+
<DialogTitle sx={{ m: 0, p: 2 }}>Create Role</DialogTitle>
183+
<IconButton
184+
aria-label="close"
185+
onClick={onCancel}
186+
sx={theme => ({
187+
position: 'absolute',
188+
right: 8,
189+
top: 8,
190+
color: theme.palette.grey[500],
191+
})}
192+
>
193+
<CloseIcon />
194+
</IconButton>
195+
<DialogContent sx={{ p: 0 }}>
196+
<CreateBase
197+
redirect={false}
198+
resource="roles"
199+
mutationOptions={{
200+
onSuccess: onCreate,
201+
}}
202+
>
203+
<SimpleForm defaultValues={{ name: filter }}>
204+
<TextInput
205+
source="name"
206+
helperText={false}
207+
autoFocus
208+
/>
209+
</SimpleForm>
210+
</CreateBase>
211+
</DialogContent>
209212
</Dialog>
210213
);
211214
};
@@ -492,6 +495,8 @@ const choices = [
492495
<AutocompleteArrayInput source="roles" choices={choices} optionValue="_id" />
493496
```
494497

498+
**Note:** `optionValue` is only supported when the choices are provided directly via the `choices` prop. If you use `<AutocompleteArrayInput>` inside a `<ReferenceArrayInput>`, the `optionValue` is always set to `id`, as the choices are records fetched from the related resource, and [records should always have an `id` field](./FAQ.md#can-i-have-custom-identifiersprimary-keys-for-my-resources).
499+
495500
## `shouldRenderSuggestions`
496501

497502
When dealing with a large amount of `choices` you may need to limit the number of suggestions that are rendered in order to maintain acceptable performance. `shouldRenderSuggestions` is an optional prop that allows you to set conditions on when to render suggestions. An easy way to improve performance would be to skip rendering until the user has entered 2 or 3 characters in the search box. This lowers the result set significantly and might be all you need (depending on your data set).
@@ -718,20 +723,14 @@ import {
718723
ReferenceArrayInput,
719724
SimpleForm,
720725
TextInput,
721-
useCreate,
722726
useCreateSuggestionContext
723727
} from 'react-admin';
724-
725728
import CloseIcon from '@mui/icons-material/Close';
726729
import {
727-
Box,
728-
BoxProps,
729-
Button,
730730
Dialog,
731731
DialogContent,
732732
DialogTitle,
733733
IconButton,
734-
TextField,
735734
} from '@mui/material';
736735

737736
const PostCreate = () => {
@@ -749,10 +748,6 @@ const PostCreate = () => {
749748

750749
const CreateTag = () => {
751750
const { filter, onCancel, onCreate } = useCreateSuggestionContext();
752-
753-
const onTagCreate = tag => {
754-
onCreate(tag);
755-
};
756751

757752
return (
758753
<Dialog open onClose={onCancel}>
@@ -774,9 +769,7 @@ const CreateTag = () => {
774769
redirect={false}
775770
resource="tags"
776771
mutationOptions={{
777-
onSuccess: tag => {
778-
onTagCreate(tag);
779-
},
772+
onSuccess: onCreate,
780773
}}
781774
>
782775
<SimpleForm defaultValues={{ name: filter }}>

0 commit comments

Comments
 (0)