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

Fix ReferenceInput filter prop change doesn't update filters #4508

Merged
merged 3 commits into from
Mar 30, 2020

Conversation

tarun-khanna
Copy link
Contributor

@tarun-khanna tarun-khanna commented Mar 11, 2020

Closes #4507

Updating filter prop on referenceInput wasn't updating the filters for fetching. The last query uses the first filters provided.

Listening on permanentFilter on setFilter callback solved the issue.

Updating filter prop on referenceInput wasn't updating the filters for fetching. The last query uses the first filters provided.
Listening on permanentFilter on setFilter callback solved the issue.
@JulienMattiussi JulienMattiussi changed the title fix(useFilterState): useCallback listens on permanent filter Fix useFilterState: useCallback listens on permanent filter changes Mar 12, 2020
@JulienMattiussi JulienMattiussi added the RFR Ready For Review label Mar 12, 2020
@fzaninotto fzaninotto merged commit d41c2ef into marmelab:master Mar 30, 2020
@fzaninotto
Copy link
Member

Thanks!

@fzaninotto fzaninotto added this to the 3.3.4 milestone Mar 30, 2020
@fzaninotto fzaninotto changed the title Fix useFilterState: useCallback listens on permanent filter changes Fix ReferenceInput filter prop change doesn't update filters Mar 30, 2020
@fancyaction
Copy link
Contributor

This isn't working for me. My input gets wiped in AutocompleteInput with ReferenceInput when using the dynamic filter. I see the filter now updates correctly, but any input in the field gets cleared.

I'm guessing the "permenantFilter" changes every render so it updates the setFilter every render which in turn is updating the autocompletInput's onChange every render, wiping my input. I've noticed this issue come up quite a bit since using hooks in my own projects.

I had a duplicate issue #4473 . I think my suggested fix there might work: Remove this fix (which is causing callback to change every render) and in that callback update permanentFilterProp in the setFilterValue. Not 100% on this because I can't run and test on my local ...

On a side note, can you help me set up my local env so I can work on this bug and others? I made post here asking for help with the Make process. Also, having trouble getting the whole npm link / yarn link process to work while trying to debug. It connects to my local RA node_module but then doesn't update if I make changes to my local RA module -- maybe this is due to my Webpack or Babel setup? I have a feeling all of this is due to my Windows setup.

I'd love to contribute to RA and some of its 3rd party modules (react-admin-date-inputs, specifically) but blocked by these issues. Any assistance would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic filter support in ReferenceInput
4 participants