We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What you were expecting:
Don't have any duplicate suggestions in the AutocompleteArrayInput.
AutocompleteArrayInput
What happened instead:
Using the ReferenceArrayInput:
ReferenceArrayInput
<ReferenceArrayInput source="relatedPosts" label="Related posts" reference="posts" > <AutocompleteArrayInput optionText="title" fullWidth /> </ReferenceArrayInput>
When editing a record that already have some relatedPosts, when you delete some of them, it produces duplicated suggestions. See the video:
relatedPosts
Steps to reproduce:
Encountered two children with the same key
Related code:
Other information:
Environment
The text was updated successfully, but these errors were encountered:
It seems to be related to the idsToFetch that are set in the useReferenceArrayInputController.ts#L54-L61.
idsToFetch
useReferenceArrayInputController.ts#L54-L61
I tried to remove the newIdsToFetch.length > 0 and it seems to work well but I know if it's a good change:
newIdsToFetch.length > 0
diff --git a/packages/ra-core/src/controller/input/useReferenceArrayInputController.ts b/packages/ra-core/src/controller/input/useReferenceArrayInputController.ts index 8aa027fa..0d9007ff 100644 --- a/packages/ra-core/src/controller/input/useReferenceArrayInputController.ts +++ b/packages/ra-core/src/controller/input/useReferenceArrayInputController.ts @@ -54,9 +54,7 @@ const useReferenceArrayInputController = ({ useEffect(() => { const newIdsToFetch = difference(input.value, inputValue.current); - if (newIdsToFetch.length > 0) { - setIdsToFetch(newIdsToFetch); - } + setIdsToFetch(newIdsToFetch); inputValue.current = input.value; }, [input.value, setIdsToFetch]);
Sorry, something went wrong.
I also encountered a another issue but I don't think it is related:
Steps:
Fixed by #3898
No branches or pull requests
What you were expecting:
Don't have any duplicate suggestions in the
AutocompleteArrayInput
.What happened instead:
Using the
ReferenceArrayInput
:When editing a record that already have some
relatedPosts
, when you delete some of them, it produces duplicated suggestions. See the video:Steps to reproduce:
Encountered two children with the same key
Related code:
Other information:
Environment
The text was updated successfully, but these errors were encountered: