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

Endless loop in Edit after deleting a reference

Open edy opened this issue 8 years ago • 5 comments

There is a case where the edit component generates an endless loop of rest requests if a referenced entry wasnt found.

What you were expecting:

No endless loops

What happened instead:

Endless loops

Steps to reproduce:

  • Visit the RA demo
  • List orders
  • Klick the user of the first order
  • Delete User
  • Go back to the orsers list
  • edit the first order

See https://imgur.com/mMxkQZL for a demo

Environment

  • React-admin version: 2.1.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: 16.4.1
  • Browser: Chrome
  • Stack trace (in case of a JS error): -

edy avatar Jul 12 '18 14:07 edy

Reproduced

fzaninotto avatar Jul 19 '18 08:07 fzaninotto

This happens in case of broken relationship: the Order tries to fetch the related Customer based on the customer_id, but the server has no such customer.

Note that the cascade delete should be handled server-side. So this is a corner case.

fzaninotto avatar Jul 19 '18 08:07 fzaninotto

This is a side effect of the onFailure meta on the crudGetOne action. When it fails, it specifies a redirectTo as list which is resolved to the basePath. In the case of the ReferenceInput page, the basePath is somehow null which seems to redirect to the current page possibly leading to a mount/remount of the components

djhi avatar Jul 22 '18 17:07 djhi

creating infinite loop when i am using <Datagrid rowClick="expand" expand={<DailyReportInfoShow />} optimized> in Edit component. I am using expand two times, once for parent resource and second for child resource . How to overcome this?

fullstacksk avatar Nov 05 '20 12:11 fullstacksk

For support question ("How To", usage advice, or troubleshooting your own code), you have two options:

  • Community support: Ask your question on StackOverFlow. This makes your question easy to find by the developer community. StackOverFlow has great SEO, gamification, voting, and reputation system.
  • Professional support: If you're a React-Admin Enterprise Edition subscriber, you have unlimited access to the Professional Support service. This service guarantees that you'll get an answer shortly.

fzaninotto avatar Nov 09 '20 10:11 fzaninotto