-
-
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
AutocompleteArrayInput wrong behavior on input changes #4724
Comments
I am getting these console errors as well. @edulecca Did you find a solution? |
@wdencker no I don't |
Reproduced in the simple example. The |
Hey. We're also seeing the same issue. Is there a fix being worked on for this (as it's causing a lot of noise in our tests). Thanks, |
I don't think anyone tried to fix it yet. Feel free to open a pull request |
Any update on a potential fix for this or workaround? |
@djhi can you explain the comment on useEffect? It's not clear to me what behaviour it's trying to ensure. I've replaced the SelectArrayInput in the demo app with AutocompleteArrayInput and the component appears to render correctly. Unfortunately the issue number mentioned in the test doesn't seem to exist:
|
Assuming the useEffect is required, i've made a PR which removes the warning and has the same behaviour. This uses length on values rather than spreading values, as this means there's a consistent sized array passed to useEffect (and the same thing is done with useMemo) |
@djhi are you happy with the fix I proposed? |
Fixed by #5044 |
What you were expecting:
AutomcompleteArrayInput should not log any React warnings on component input value changes related to useMemo or useEffect hooks.
What happened instead:
Every time the AutomcompleteArrayInput gets a new value or some of them are deleted, so on every component's update, the console log 2 warning related to useMemo and useEffect
Steps to reproduce:
Ir order to reproduce the issue just import AutocompleteArrayInput and use it within a wrapper or just without it and passing directiley the choices with a constant.
Related code:
Just replace on examples/demo/src/visitors/SegmentsInput.tsx the
<SelectArrayInput/>
to<AutocompleteArrayInput/>
and will get the warnings.Other information:
There is a note on the component
couldnt figure it out if the "reset the filter" is afecting the hooks behaivor
Environment
node v13.12.0
ra-admin 3.4.2
OS OSX 10.15.4
chrome 81.0.4044.113
The text was updated successfully, but these errors were encountered: