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

Race condition when applying List filter and changing page #7368

Closed
fzaninotto opened this issue Mar 9, 2022 · 1 comment · Fixed by #7444
Closed

Race condition when applying List filter and changing page #7368

fzaninotto opened this issue Mar 9, 2022 · 1 comment · Fixed by #7444
Assignees
Labels

Comments

@fzaninotto
Copy link
Member

Steps to reproduce

  1. Open the Simple example codesandbox
  2. In the post List, enable the title filter
  3. Type a few characters in the title input
  4. Immediately after, click on the Comments menu
  5. The Title filter is applied oni the Comments list (which is wrong, as comments have no title

Analysis

The setFilters called by <FilterForm> is debounced by default. This means that it changes the URL 300ms after the user applies a filter. But if the user has already moved to another page, the redirection happens on the wrong page.

Possible solutions

  1. in useListController, keep track of calls to setFilters, and cancel them on unmount
  2. in useListParams, only call navigate if the location maches the current resource

Environment

  • React-admin version: v3 and v4
  • Last version that did not exhibit the issue (if applicable): none, the bug has always been here
  • React version: 17
  • Browser: Chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant