react-admin
react-admin copied to clipboard
ReferenceArrayInput with AutocompleteArrayInput flickers and resets value on search when used with format and parse
What you were expecting: When using AutocompleteArrayInput with a ReferenceArrayInput with parse/format options:
- the options list should not flicker
- the input value should not reset itself
What happened instead:
- the options list values flicker
- the input value resets itself
Steps to reproduce:
- Open code sandbox
- In the preview window, go to Comments list
- Click on the icon to create a new comment
- Select any value(s) in the Comments input
- Enter any few characters
Related code: CodeSandox: https://codesandbox.io/s/array-reference-input-xrrv94?file=/src/posts/PostCreate.tsx
Environment
- React-admin version: 4.7.1
Reproduced, thanks
HI, I updated the CodeSanbox to react-admin 4.7.2 but the issue still persist with parse & format options.
Indeed!
I tried to make sure the format
and parse
props were not causing the re-render by moving them to a const
, but the issue is still there.
The issue is not present however when you remove the format
and parse
props (which is what the PR #8599 fixed).
Reopening
This actually makes sense inside a ReferenceArrayInput
as it expects a specific format for the values (array of ids). @tomek3e, would you mind explaining your use case? Otherwise, I'll mark this as a documentation issue.