React-admin: Application Cache does not work when using ReferenceInput inside Filter

Created on 13 Apr 2020  路  3Comments  路  Source: marmelab/react-admin

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:

  1. Open the app (in the attached codesanbox)
  2. When posts are loaded you will see a log that GET_LIST method was called for posts
  3. Go to Users types and you will see a log that GET_LIST method was done for user_types
  4. 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.
  5. 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)
  6. 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):
bug

Most helpful comment

Linked to #4531 I believe

All 3 comments

Thanks for reporting this. We can't investigate without a way to reproduce it. Please create a codesandbox showing the issue

@djhi Done! I also added more details on the steps to reproduce it

Linked to #4531 I believe

Was this page helpful?
0 / 5 - 0 ratings