-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Infinite re-rendering using disabled AutocompleteArrayInput in a ReferenceArrayInput #9714
Comments
Reproduced, thanks for this report 🙏 |
Interesting: I can reproduce with 2 ReferenceArrayInputs const PostEdit = () => (
<Edit>
<SimpleForm defaultValues={{ average_note: 0 }} warnWhenUnsavedChanges>
<ReferenceArrayInput source="authors" reference="users">
<AutocompleteArrayInput fullWidth disabled />
</ReferenceArrayInput>
<TagReferenceInput reference="tags" source="tags" label="Tags" />
</SimpleForm>
</Edit>
); But not with 1: const PostEdit = () => (
<Edit>
<SimpleForm defaultValues={{ average_note: 0 }} warnWhenUnsavedChanges>
<ReferenceArrayInput source="authors" reference="users">
<AutocompleteArrayInput fullWidth disabled />
</ReferenceArrayInput>
{/*<TagReferenceInput reference="tags" source="tags" label="Tags" /> */}
</SimpleForm>
</Edit>
); See my stackblitz https://stackblitz.com/edit/github-dmhu7h-ytpyvk?file=src%2Fposts%2FPostEdit.tsx |
I confirm the bug is triggered by having 2 ReferenceArrayInput in the same form, one of which at least uses a |
No need for const PostEdit = () => (
<Edit>
<SimpleForm>
<AutocompleteArrayInput source="authors" disabled choices={[]} />
<AutocompleteArrayInput source="tag_ids" choices={[]} />
</SimpleForm>
</Edit>
); Click on the second input to trigger the bug |
The bug requires react-hook-form >= 7.49.1. It doesn't occur with v4.19.0. It's probably caused by one of the two following changes:
See https://github.com/react-hook-form/react-hook-form/releases/tag/v7.49.1 |
The bug occurs here in react-admin:
Commenting this line removed the bug. |
What you were expecting:
An stable page with a An AutocompleteArrayInput in an ReferenceArrayInput
What happened instead:
AutocompleteArrayInput keeps re-rendering
Steps to reproduce:
Add a disabled AutocompleteArrayInput in a ReferenceArrayInput
Related code:
https://stackblitz.com/edit/github-dmhu7h?file=src%2Fposts%2FPostEdit.tsx,package.json
Other information:
Environment
My poor Firefox 🦊
![image](https://private-user-images.githubusercontent.com/5849835/312139907-83aade31-75e9-4b28-ab26-7d80d5a06738.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMjk3NDMsIm5iZiI6MTczOTIyOTQ0MywicGF0aCI6Ii81ODQ5ODM1LzMxMjEzOTkwNy04M2FhZGUzMS03NWU5LTRiMjgtYWIyNi03ZDgwZDVhMDY3MzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTBUMjMxNzIzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDE0NDQwN2IxOWY3YzI1NDA4M2ZlNDFjMmJiZjE3NWZlNmZhYTcyMmEzN2U5OWJiYjAyZjFkYWY4MDFhYjQ2MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.68i-IQEKI_SDTlpwqnxC8jtEM9YsPJChTAbZ8fIDLY0)
The text was updated successfully, but these errors were encountered: