React-admin: Permanent filter mapped to state value doesn't filter correctly

Created on 16 Apr 2019  路  6Comments  路  Source: marmelab/react-admin

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.

bug

All 6 comments

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

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

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)

@manuelamaria Thanks for the report and codesandbox

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kdabir picture kdabir  路  3Comments

yangjiamu picture yangjiamu  路  3Comments

Dragomir-Ivanov picture Dragomir-Ivanov  路  3Comments

ilaif picture ilaif  路  3Comments

kikill95 picture kikill95  路  3Comments