Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SimpleList] deprecate linkType, and implement rowClick as for the DataGrid #10349

Open
wants to merge 96 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
ef91843
Update create-react-admin for 5.3.0
Oct 17, 2024
aa4e679
v5.3.0
Oct 17, 2024
4db23bf
Update yarn.lock for 5.3.0
Oct 17, 2024
a7adc14
[no ci] Add missing entry in changelog
fzaninotto Oct 18, 2024
8663c65
Revert "[no ci] Add missing entry in changelog"
fzaninotto Oct 18, 2024
9b029e8
Fix AutocompleteInput displays 'Create' option for choices that alrea…
slax57 Oct 21, 2024
559f8e3
use CreateLabel story in tests
slax57 Oct 21, 2024
68d09a6
Add story for partial pagination
fzaninotto Oct 22, 2024
2e16c9a
Fix no results message has untranslated resource name
fzaninotto Oct 22, 2024
2751b6a
Update bug report issue template
Oct 22, 2024
7db57cc
Update .github/ISSUE_TEMPLATE/Bug_report.md
djhi Oct 22, 2024
776985a
Fix double decoding of ids in URLs
Oct 22, 2024
c1eae24
Fix storybook
Oct 22, 2024
c19d16e
Fix smart count for no results message
thibault-barrat Oct 23, 2024
8844afd
Use right count when humanize resource label
thibault-barrat Oct 23, 2024
f7d58e4
Fix useGetResourceLabel test with 0 count
thibault-barrat Oct 23, 2024
c9aa90d
doc: fix readme typo
antoinefricker Oct 24, 2024
586b17c
[no ci] [Doc] Remove outdated warning about `<SimpleFormIterator>` cl…
slax57 Oct 25, 2024
dfffab8
[Doc] Fix Authorization link in Authentication page
Oct 25, 2024
b8ab7a6
Add a story for issue with ArrayInput dynamically added inputs with s…
djhi Oct 11, 2024
fd398a5
fix issue (and improve story)
slax57 Oct 24, 2024
6bc9595
warn against using shouldUnregister with ArrayInput in the docs
slax57 Oct 24, 2024
3a88db3
[no ci] doc: mention the transform prop as a workaround
slax57 Oct 24, 2024
475323d
revert the fix (and story)
slax57 Oct 25, 2024
dc7055e
[no ci] revert imports order change
slax57 Oct 25, 2024
53ec5c0
Update Changelog for 5.3.1
Oct 25, 2024
5f99497
v5.3.1
Oct 25, 2024
6e0af84
Update yarn.lock for 5.3.1
Oct 25, 2024
d060f69
Fix DateInput messes up dates in some timezones
Oct 24, 2024
bf15705
Revert unnecessary change
Oct 24, 2024
e7578f2
Clean up tests
Oct 24, 2024
a557450
Fix test that was converted to story incorrectly
Oct 25, 2024
127d0da
Add a story for onChange validation mode
Oct 25, 2024
47127f8
Simplify and uniformize
Oct 25, 2024
5614d0c
Don't trigger onChange unnecessarily
Oct 25, 2024
d84f18d
Fix stories
fzaninotto Oct 28, 2024
fe7ae7e
Add more comments and tests
fzaninotto Oct 28, 2024
4d8f119
Fix TS error
fzaninotto Oct 28, 2024
2666018
Fix typo
fzaninotto Oct 28, 2024
df8f8ec
Re-fix typo
fzaninotto Oct 28, 2024
3625f5e
[Doc] Fix typo in TabbedForm and TabbedShowLayout
highwide Oct 28, 2024
8707db2
[DOC] Add missing parameter in NextJs
Ariyn Oct 28, 2024
a017b63
Leverage canAccess in CRM demo
Oct 25, 2024
f463de2
Avoid calling the dataProvider for each canAccess calls
Oct 25, 2024
2424247
Fix ReferenceField link is wrong when the record is not yet loaded
fzaninotto Oct 28, 2024
df0304d
[no ci] [Doc] Fix links to react-dropzone doc pages
slax57 Oct 28, 2024
f0caa14
Fix DateInput ignores the timezone when given
fzaninotto Oct 28, 2024
c29e0f9
Fix undo logic not working when doing multiple deletions one by one
fzaninotto Oct 24, 2024
b94c4ef
Add unit test
fzaninotto Oct 25, 2024
66aa65d
Improve test
fzaninotto Oct 28, 2024
a7bade2
Update packages/ra-core/src/dataProvider/undo/index.ts
fzaninotto Oct 29, 2024
a120f73
Fix linter warning
fzaninotto Oct 29, 2024
6201d98
Fix `<SimpleList>` throws an error when no data in standalone mode
fzaninotto Oct 29, 2024
c3bd39c
Fix `<Edit>` ignores mutation meta when updating the `getOne` cache
fzaninotto Oct 29, 2024
7c7643f
Use call time meta when provided
fzaninotto Oct 29, 2024
2f8d8fd
Revert now useless change
fzaninotto Oct 29, 2024
378339d
Remove deprecated 'initialValue' from sanitizeInputRestProps
afilp Sep 18, 2024
e37c9ac
Add files via upload
danyalutsevich Oct 28, 2024
c9e8dcf
Eicrud logo
danyalutsevich Oct 29, 2024
638e994
Update DataProviderList.md
danyalutsevich Oct 29, 2024
69ea5a4
Delete docs/img/eicrud.svg
danyalutsevich Oct 29, 2024
9f987b2
Update DataProviderList.md
danyalutsevich Oct 30, 2024
70fd551
Remove erroneous changelog
fzaninotto Oct 31, 2024
bc7f83c
[Doc] Update `<StackedFilters>` documentation for `defaultValue`
erwanMarmelab Oct 30, 2024
3650f69
[no ci] Update docs/StackedFilters.md
slax57 Oct 31, 2024
8487100
changelog for 5.3.2
slax57 Oct 31, 2024
4df60ba
v5.3.2
slax57 Oct 31, 2024
3d549c9
update yarn.lock
slax57 Oct 31, 2024
75d665c
fix DateInput DefaultValue story
slax57 Nov 4, 2024
7095ad8
Update Tip
erwanMarmelab Nov 4, 2024
6b5f002
[skip ci] fix word duplication
erwanMarmelab Nov 4, 2024
fa0df32
Update bold to code
erwanMarmelab Nov 4, 2024
8c48513
[doc] Improve `useUpdate` usage instructions
fzaninotto Nov 4, 2024
ce6ebea
Fix typo
djhi Nov 5, 2024
d7771c5
Update horizontal navigation reference
emmanuel-ferdman Nov 5, 2024
71ae979
[Doc] Document usage of DatagridAG inside an InfiniteList
Nov 5, 2024
8fb2d2f
Fix Datagrid header tooltip sometimes indicates the wrong sort order
fzaninotto Nov 7, 2024
1cbb1c8
Fix unit test
fzaninotto Nov 7, 2024
0966dc8
fix(ra-data-graphql-simple): Unify meta location in buildVariables
dricholm Oct 31, 2024
62de18e
Fix `<DateInput>` and `<DateTimeInput>` do not react to form changes
Nov 7, 2024
5c5c41f
Simplify code, test reset
Nov 8, 2024
a1c3c91
Add tests for parse
Nov 8, 2024
bcfba35
Fix Datagrid header tooltip shows column names with a capital letter
fzaninotto Nov 7, 2024
c8ed828
disable createLabel item for components that also provide createItemL…
slax57 Oct 31, 2024
f303139
wip: add a NoCreateItemLabel story
slax57 Oct 31, 2024
d0ceef2
fix NoCreateItemLabel story
slax57 Nov 4, 2024
a9a4131
AutocompleteInput tests
slax57 Nov 4, 2024
bed080a
remove NoCreateItemLabel story and test
slax57 Nov 8, 2024
f387004
add tests for AutocompleteArrayInput
slax57 Nov 8, 2024
a185478
Add SelectInput and SelectArrayInput tests
slax57 Nov 8, 2024
f44e137
fix AutocompleteArrayInput test
slax57 Nov 8, 2024
e03e3e3
[no ci] update docs
slax57 Nov 8, 2024
bb9177e
Update changelog for 5.3.3
Nov 8, 2024
84ae08f
v5.3.3
Nov 8, 2024
d513db7
Update yarn.lock for 5.3.3
Nov 8, 2024
6ca2f0d
refacto(SimpleList): deprecate linkType => rowClick
Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ about: Something isn't working as expected. Please tell us!
<!-- If you are able to illustrate the bug or feature request with an example, please provide a sample application via one of the following means: -->

* Preferably, a sandbox forked from
- https://codesandbox.io/p/github/marmelab/react-admin-sandbox/main (v5)

- https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple (v5)
- https://stackblitz.com/github/marmelab/react-admin/tree/4.x/examples/simple (v4)
* A link to a GitHub repo with the minimal codebase to reproduce the issue
Expand Down
113 changes: 39 additions & 74 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/ArrayInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Check [the `<SimpleFormIterator>` documentation](./SimpleFormIterator.md) for de

**Tip**: If you need to edit an array of *related* records, i.e. if the `items` above actually come from another resource, you should use a [`<ReferenceManyInput>`](./ReferenceManyInput.md) instead.

**Note**: Using [`shouldUnregister`](https://react-hook-form.com/docs/useform#shouldUnregister) should be avoided when using `<ArrayInput>` (which internally uses `useFieldArray`) as the unregister function gets called after input unmount/remount and reorder. This limitation is mentioned in the react-hook-form [documentation](https://react-hook-form.com/docs/usecontroller#props). If you are in such a situation, you can use the [`transform`](https://marmelab.com/react-admin/Edit.html#transform) prop to manually clean the submitted values.

## Props

`<ArrayInput>` accepts the [common input props](./Inputs.md#common-input-props) (except `format` and `parse`).
Expand Down
2 changes: 1 addition & 1 deletion docs/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export const dataProvider = addRefreshAuthToDataProvider(baseDataProvider, refre

## Authorization

Access control and permissions allow you to restrict certain pages to specific users. React-admin provides powerful primitives for implementing authorization logic. For detailed guidance, check out the [Authorization](./Authorization.md) documentation.
Access control and permissions allow you to restrict certain pages to specific users. React-admin provides powerful primitives for implementing authorization logic. For detailed guidance, check out the [Authorization](./Permissions.md) documentation.

<video controls autoplay muted loop>
<source src="./img/AccessControl.mp4" type="video/mp4"/>
Expand Down
37 changes: 34 additions & 3 deletions docs/AutocompleteArrayInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ The form value for the source must be an array of the selected values, e.g.
|----------------------------|----------|-----------------------|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `choices` | Required | `Object[]` | - | List of choices |
| `create` | Optional | `Element` | `-` | A React Element to render when users want to create a new choice |
| `createLabel` | Optional | `string` | `ra.action. create` | The label for the menu item allowing users to create a new choice. Used when the filter is empty |
| `createItemLabel` | Optional | `string` | `ra.action .create_item` | The label for the menu item allowing users to create a new choice. Used when the filter is not empty |
| `createLabel` | Optional | `string` | - | The label used as hint to let users know they can create a new choice. Displayed when the filter is empty. |
| `createItemLabel` | Optional | `string` | `ra.action .create_item` | The label for the menu item allowing users to create a new choice. Used when the filter is not empty. |
| `debounce` | Optional | `number` | `250` | The delay to wait before calling the setFilter function injected when used in a ReferenceArray Input. |
| `emptyValue` | Optional | `any` | `''` | The value to use for the empty element |
| `filterToQuery` | Optional | `string` => `Object` | `q => ({ q })` | How to transform the searchText into a parameter for the data provider |
Expand Down Expand Up @@ -159,7 +159,7 @@ const choices = [
const UserCreate = () => (
<Create>
<SimpleForm>
<SelectArrayInput
<AutocompleteArrayInput
source="roles"
choices={choices}
create={<CreateRole />}
Expand Down Expand Up @@ -216,6 +216,37 @@ If you just need to ask users for a single string to create the new option, you

If you're in a `<ReferenceArrayInput>` or `<ReferenceManyToManyInput>`, the `handleSubmit` will need to create a new record in the related resource. Check the [Creating New Choices](#creating-new-choices) for an example.

## `createLabel`

When you set the `create` or `onCreate` prop, `<AutocompleteArrayInput>` lets users create new options.
You can use the `createLabel` prop to render an additional (disabled) menu item at the bottom of the list, that will only appear when the input is empty, inviting users to start typing to create a new option.

```jsx
<AutocompleteArrayInput
source="roles"
choices={choices}
create={<CreateRole />}
createLabel="Start typing to create a new item"
/>
```

## `createItemLabel`

If you set the `create` or `onCreate` prop, `<AutocompleteArrayInput>` lets users create new options. When the text entered by the user doesn't match any option, the input renders a "Create XXX" menu item at the bottom of the list.

You can customize the label of that menu item by setting a custom translation for the `ra.action.create_item` key in the translation files.

Or, if you want to customize it just for this `<AutocompleteArrayInput>`, use the `createItemLabel` prop:

```jsx
<AutocompleteArrayInput
source="roles"
choices={choices}
create={<CreateRole />}
createItemLabel="Add a new role: %{item}"
/>
```

## `debounce`

When used inside a [`<ReferenceArrayInput>`](./ReferenceArrayInput.md), `<AutocompleteArrayInput>` will call `dataProvider.getList()` with the current input value as filter after a delay of 250ms. This is to avoid calling the API too often while users are typing their query.
Expand Down
6 changes: 3 additions & 3 deletions docs/AutocompleteInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ The form value for the source must be the selected value, e.g.
|--------------------------- |----------|---------------------- |---------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `choices` | Optional | `Object[]` | `-` | List of items to autosuggest. Required if not inside a ReferenceInput. |
| `create` | Optional | `Element` | `-` | A React Element to render when users want to create a new choice |
| `createLabel` | Optional | `string` | `ra.action .create` | The label for the menu item allowing users to create a new choice. Used when the filter is empty |
| `createItemLabel` | Optional | `string` | `ra.action .create_item` | The label for the menu item allowing users to create a new choice. Used when the filter is not empty |
| `createLabel` | Optional | `string` | - | The label used as hint to let users know they can create a new choice. Displayed when the filter is empty. |
| `createItemLabel` | Optional | `string` | `ra.action .create_item` | The label for the menu item allowing users to create a new choice. Used when the filter is not empty. |
| `debounce` | Optional | `number` | `250` | The delay to wait before calling the setFilter function injected when used in a ReferenceInput. |
| `emptyText` | Optional | `string` | `''` | The text to use for the empty element |
| `emptyValue` | Optional | `any` | `''` | The value to use for the empty element |
Expand Down Expand Up @@ -226,7 +226,7 @@ If you just need to ask users for a single string to create the new option, you
## `createLabel`

When you set the `create` or `onCreate` prop, `<AutocompleteInput>` lets users create new options.
You can use the `createLabel` prop to render an additional menu item at the bottom of the list, that will only appear when the input is empty, inviting users to start typing to create a new option.
You can use the `createLabel` prop to render an additional (disabled) menu item at the bottom of the list, that will only appear when the input is empty, inviting users to start typing to create a new option.

![Create Label](./img/AutocompleteInput-createLabel.png)

Expand Down
1 change: 1 addition & 0 deletions docs/DataProviderList.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ If you can't find a Data Provider for your backend below, no worries! [Writing a
* ![corebos Logo](./img/backend-logos/corebos.png "corebos Logo")**[coreBOS](https://corebos.com/)**: [React-Admin coreBOS Integration](https://github.com/coreBOS/reactadminportal)
* ![directus Logo](./img/backend-logos/directus.svg "directus Logo")**[Directus](https://directus.io/)**: [marmelab/ra-directus](https://github.com/marmelab/ra-directus/blob/main/packages/ra-directus/Readme.md)
* ![django Logo](./img/backend-logos/django.png "django Logo")**[Django Rest Framework](https://www.django-rest-framework.org/)**: [bmihelac/ra-data-django-rest-framework](https://github.com/bmihelac/ra-data-django-rest-framework)
* ![Eicrud Logo](./img/backend-logos/eicrud.svg "EiCrud Logo")**[Eicrud](https://github.com/eicrud/eicrud)**: [danyalutsevich/ra-data-eicrud](https://github.com/danyalutsevich/ra-data-eicrud)
* ![eve Logo](./img/backend-logos/eve.png "eve Logo")**[Eve](https://docs.python-eve.org/en/stable/)**: [smeng9/ra-data-eve](https://github.com/smeng9/ra-data-eve)
* ![Express Mangoose Logo](./img/backend-logos/github.svg "Express Mangoose Logo")**[Express & Mongoose](https://github.com/NathanAdhitya/express-mongoose-ra-json-server)**: [NathanAdhitya/express-mongoose-ra-json-server](https://github.com/NathanAdhitya/express-mongoose-ra-json-server)
* ![Express Sequelize Logo](./img/backend-logos/github.svg "Express Sequelize Logo")**[Express & Sequelize](https://github.com/lalalilo/express-sequelize-crud)**: [express-sequelize-crud](https://github.com/lalalilo/express-sequelize-crud)
Expand Down
33 changes: 32 additions & 1 deletion docs/DatagridAG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,38 @@ Here are the important things to note:

- You need to import the ag-grid stylesheets `ag-grid.css` and `ag-theme-alpine.css`.
- The columns are defined using the `columnDefs` prop. See [the dedicated doc section](#columndefs) for more information.
- [`<InfiniteList>`](./InfiniteList.md) is not supported.

### Usage Inside An `<InfiniteList>`

`<DatagridAG>` also supports being used as a child of a react-admin [`<InfiniteList>`](./InfiniteList.md).

It only requires setting the `pagination` prop to `false`, because `<DatagridAG>` will itself detect when it needs to fetch more data, and the `<InfiniteList>` default pagination component would conflict with this behavior.

```tsx
import '@ag-grid-community/styles/ag-grid.css';
import '@ag-grid-community/styles/ag-theme-alpine.css';
import React from 'react';
import { InfiniteList } from 'react-admin';
import { DatagridAG } from '@react-admin/ra-datagrid-ag';

export const PostList = () => {
const columnDefs = [
{ field: 'title' },
{ field: 'published_at' },
{ field: 'body' },
];
return (
<InfiniteList pagination={false}>
<DatagridAG columnDefs={columnDefs} />
</InfiniteList>
);
};
```

<video controls autoplay playsinline muted loop>
<source src="https://react-admin-ee.marmelab.com/assets/DatagridAG-infinite.mp4" type="video/mp4"/>
Your browser does not support the video tag.
</video>

### Filter Syntax

Expand Down
13 changes: 12 additions & 1 deletion docs/DateInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ import { DateInput } from 'react-admin';
<DateInput source="published_at" />
```

The field value must be a string with the pattern `YYYY-MM-DD` (ISO 8601), e.g. `'2022-04-30'`.
The field value must be a string using the pattern `YYYY-MM-DD` (ISO 8601), e.g. `'2022-04-30'`. The returned input value will also be in this format, regardless of the browser locale.

`<DateInput>` also accepts values that can be converted to a `Date` object, such as:

- a localized date string (e.g. `'30/04/2022'`),
- an ISO date string (e.g. `'2022-04-30T00:00:00.000Z'`),
- a `Date` object, or
- a Linux timestamp (e.g. `1648694400000`).

In these cases, `<DateInput>` will automatically convert the value to the `YYYY-MM-DD` format.

**Note**: This conversion may change the date because of timezones. For example, the date string `'2022-04-30T00:00:00.000Z'` in Europe may be displayed as `'2022-04-29'` in Honolulu. If this is not what you want, pass your own [`parse`](./Inputs.md#parse) function to `<DateInput>`.

## Props

Expand Down
2 changes: 1 addition & 1 deletion docs/Demos.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Atomic CRM is a complete CRM app allowing to manage contacts, companies, deals,

The source shows how to implement the following features:

- [Horizontal navigation](https://github.com/marmelab/react-admin/blob/master/examples/crm/src/Layout.tsx)
- [Horizontal navigation](https://github.com/marmelab/react-admin/blob/master/examples/crm/src/layout/Layout.tsx)
- [Custom exporter](https://github.com/marmelab/react-admin/blob/master/examples/crm/src/contacts/ContactList.tsx)
- [Trello-like Kanban board for the deals pipeline](https://github.com/marmelab/react-admin/blob/master/examples/crm/src/deals/DealListContent.tsx)
- [Custom d3.js / Nivo Chart in the dashboard](https://github.com/marmelab/react-admin/blob/master/examples/crm/src/dashboard/DealsChart.tsx)
Expand Down
2 changes: 1 addition & 1 deletion docs/FileInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ If `multiple` is set to `false` and additional files are dropped, all files besi

## `options`

`<FileInput>` accepts an `options` prop into which you can pass all the [react-dropzone properties](https://react-dropzone.netlify.com/#proptypes).
`<FileInput>` accepts an `options` prop into which you can pass all the [react-dropzone properties](https://react-dropzone.js.org/#src).

## `placeholder`

Expand Down
2 changes: 2 additions & 0 deletions docs/Forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ import { FormDataConsumer } from 'react-admin';

**Note**: By default, `react-hook-form` submits values of unmounted input components. In the above example, the `shouldUnregister` prop of the `<SimpleForm>` component prevents that from happening. That way, when end users hide an input, its value isn't included in the submitted data.

**Note**: `shouldUnregister` should be avoided when using `<ArrayInput>` (which internally uses `useFieldArray`) as the unregister function gets called after input unmount/remount and reorder. This limitation is mentioned in the react-hook-form [documentation](https://react-hook-form.com/docs/usecontroller#props). If you are in such a situation, you can use the [`transform`](https://marmelab.com/react-admin/Edit.html#transform) prop to manually clean the submitted values.

## Transforming Form Values Before Submitting

Sometimes, you may want to alter the form values before sending them to the `dataProvider`. For those cases, use the `transform` prop either on the view component (`<Create>` or `<Edit>`) or on the `<SaveButton>` component.
Expand Down
2 changes: 1 addition & 1 deletion docs/ImageInput.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ If `multiple` is set to `false` and additional files are dropped, all files besi

## `options`

`<ImageInput>` accepts an `options` prop into which you can pass all the [react-dropzone properties](https://react-dropzone.netlify.com/#proptypes).
`<ImageInput>` accepts an `options` prop into which you can pass all the [react-dropzone properties](https://react-dropzone.js.org/#src).

## `placeholder`

Expand Down
2 changes: 2 additions & 0 deletions docs/Inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ import { FormDataConsumer } from 'react-admin';

**Note**: By default, `react-hook-form` submits values of unmounted input components. In the above example, the `shouldUnregister` prop of the `<SimpleForm>` component prevents that from happening. That way, when end users hide an input, its value isn't included in the submitted data.

**Note**: `shouldUnregister` should be avoided when using `<ArrayInput>` (which internally uses `useFieldArray`) as the unregister function gets called after input unmount/remount and reorder. This limitation is mentioned in the react-hook-form [documentation](https://react-hook-form.com/docs/usecontroller#props). If you are in such a situation, you can use the [`transform`](https://marmelab.com/react-admin/Edit.html#transform) prop to manually clean the submitted values.

## Overriding The Input Variant

Material UI offers [3 variants for text fields](https://mui.com/material-ui/react-text-field/#basic-textfield): `outlined`, `filled`, and `standard`. The default react-admin theme uses the `filled` variant.
Expand Down
2 changes: 2 additions & 0 deletions docs/NextJs.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ async function handler(request: Request) {
request.headers.get('content-type') ?? 'application/json',
// supabase authentication
apiKey: process.env.SUPABASE_SERVICE_ROLE ?? '',
Authorization: "Bearer " + process.env.SUPABASE_SERVICE_ROLE ?? '',
},
};

Expand Down Expand Up @@ -260,6 +261,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
["content-type"]: req.headers["content-type"] ?? "application/json",
// supabase authentication
apiKey: process.env.SUPABASE_SERVICE_ROLE ?? '',
Authorization: "Bearer " + process.env.SUPABASE_SERVICE_ROLE ?? '',
},
};
if (req.body) {
Expand Down
2 changes: 1 addition & 1 deletion docs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import simpleRestProvider from "ra-data-simple-rest";
const root = createRoot(document.getElementById("root"));
root.render(
<Admin dataProvider={simpleRestProvider("http://localhost:3000")}>
<Resource name="posts" list={ListGuesser} edit={EditHuesser} />
<Resource name="posts" list={ListGuesser} edit={EditGuesser} />
</Admin>
);
```
Expand Down
Loading
Loading