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

Permanent filter mapped to state value doesn't filter correctly #3132

Closed
manuelamaria opened this issue Apr 16, 2019 · 6 comments · Fixed by #3308
Closed

Permanent filter mapped to state value doesn't filter correctly #3132

manuelamaria opened this issue Apr 16, 2019 · 6 comments · Fixed by #3308
Labels

Comments

@manuelamaria
Copy link

What you were expecting:

I mapped a permanent list filter to a state value from the redux store (with custom reducer). Let's say that's value1.
When the state value is changed, the list should be filtered by this new value (value2).

What happened instead:

Instead, the list re-renders, but it is still filtered by value1. When changing the value to value3, the list gets filtered with value2 (so always one "step" back). I logged the mapped prop to the console in the list component and it is correct. Only the api parameters "stay behind".

Related code:
I set up a Codesandbox here. Unfortunately I get some console errors there that I don't get in my real-case scenario (might be related to using a fake data provider, but I couldn't figure them out).

  • React-admin version: 2.8.5
  • React version: 16.7

Thank you for considering this.

@TomJannes
Copy link
Contributor

I noticed the same problem with the ReferenceArrayInput and the filter property.

@dvddpl
Copy link

dvddpl commented May 13, 2019

same here. I have a ReferenceArrayInput (wrapped into a FormDataConsumer) whose filter depends on values in the formData updated from other Input components. Consolelogging the form data at each component interaction shows the right values but the rendered component is always one selection behind

@dvddpl
Copy link

dvddpl commented May 14, 2019

debugging in Redux Tool "@@redux-form/CHANGE" properly contains the new value ( and shows the corrected diff from previous state) but in the following Action "RA/CRUD_GET_MATCHING" the payload contains still the old values ( therefore the component is not updated)

@djhi
Copy link
Collaborator

djhi commented May 20, 2019

@manuelamaria Thanks for the report and codesandbox

@mrlaseptima
Copy link

I have same problem. I have a ReferenceArrayInput (wrapped into a FormDataConsumer) and have same problem .
when you fix this BUG ???

@fzaninotto
Copy link
Member

@mrlaseptima this is a community project, feel free to give us a hand if this fix is critical for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants