react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

List reacts on filter, pagination and sorting parameters if they are set in dialog modal

Open mikethebeer opened this issue 6 years ago • 1 comments

What you were expecting: Once a <Dialog /> modal contains a <List /> view of Resource A and has filtering + pagination active, the <List /> view of Resource B that is still visible behind the modal ignores the URL query params set by the List view of Resource B - and therefore does not re-render.

What happened instead: Once a <Dialog /> modal contains a <List /> view of Resource A and has filtering + pagination active, the <List /> view of Resource B that is still visible behind the modal notices the query params set by the List view of Resource B - and therefore re-renders its resultset.

Because of the query params page, order, filter etc. the list view in the background gets re-rendered although it shows a list of records that belongs to another resource.

https://myadmin.dev/#/posts?displayedFilters=%7B%22commentable%22%3Atrue%7D&filter=%7B%22commentable%22%3Atrue%2C%22q%22%3A%22lorem%20%22%7D&order=DESC&page=1&perPage=10&sort=published_at

Steps to reproduce:

  1. Create a <List /> view of a Resource A
  2. Create an action that opens a <Dialog /> modal (without location change!!)
  3. <Dialog /> modal contains a <List /> view with pagination + filters of Resource B
  4. Changing the pagination or the filters in Resource B causes the List view in the background to re-render.

Environment

  • React-admin version: 3.5.5
  • Last version that did not exhibit the issue (if applicable): -
  • React version: 16.13.1
  • Browser: Chrome, Firefox, Safari
  • Stack trace (in case of a JS error): -

mikethebeer avatar Jun 25 '20 14:06 mikethebeer

There can be only one <List> per route, as <List> uses routing. You have to write your own component to display a custom list inside a Dialog.

fzaninotto avatar Jun 28 '20 14:06 fzaninotto