What I was expecting:
When getList method is called from a filter, I expect that when the same call is executed React Admin does not call the method again but instead takes the result from the redux store.
What happened instead:
The call is being made every time the filter is loaded, even tough the request body, type (GET_LIST) and resource is the same.
Steps to reproduce:
- Open the app (in the attached codesanbox)
- When posts are loaded you will see a log that GET_LIST method was called for posts
- Go to Users types and you will see a log that GET_LIST method was done for user_types
- If you go back to posts and go back to user types you will see that no call is done for either of them, which is the expected.
- Now, go to users. You will see 3 calls logged: GET_LIST for users, GET_MANY for user_types (the one used to get the user type names in the grid) and GET_LIST for user_types (the one used by the filter)
- Go back to posts (no call performed, good!), and then go back to users screen again. Here you will notice that no call was done for GET_MANY for user_types nor for GET_LIST for users (they were both taken from cache, which is good) but you will see a call to GET_LIST for user_types, even though the request is the same, and this is not expected.
Related code:
https://codesandbox.io/s/react-admin-referenceinput-cache-issue-t9md3
Environment
- React-admin version: 3.4.0
- Last version that did not exhibit the issue (if applicable):
- React version: 16.13.1
- Browser: Google Chrome, Version 81.0.4044.92
- Stack trace (in case of a JS error):
Most helpful comment
Linked to #4531 I believe