0

I have an app which is using React with admin-on-rest. I have a resource and it has a ListView and the user can navigate to the EditView from there.

Apparently, admin-on-rest uses the same object that is fetched on the ListView for the EditView as well. The problem arises when two users are at the ListView and one edits a resource while the other is still at the ListView. When the first one saves some changes, the second user goes to the EditView of the same resource but she doesn't have the latest version of it. Therefore if the second user saves some changes all of the changes the first user has made will be lost.

Is there a way to force admin-on-rest to re-fetch the resource from server when the EditViews is mounted?

omid.n
  • 491
  • 5
  • 22
  • For me it automatically refreshes. I'm using https://github.com/leperone/aor-parseserver-client but I don't think that matters. As I see in the Redux debugger that after all the `@@redux-form/REGISTER_FIELD` actions it fires a `CRUD_GET_ONE` action to fetch the latest data and it refreshes it. I tried looking at the listview, updating in Parse and then hitting the edit button, it first showed the old data, but then it has been refreshed with the new one. Try this tool: https://github.com/gaearon/redux-devtools and see what actions are happening for you. – jkrnak Mar 30 '17 at 07:43
  • which version of admin-on-rest are you using? – omid.n Mar 30 '17 at 18:36
  • It was on 0.9.2 – jkrnak Mar 31 '17 at 07:34
  • okay, thanks. I'll look into it. I was using v0.6.2. Maybe they have already fixed that. – omid.n Mar 31 '17 at 10:35
  • I can confirm that admin-on-rest always refetches the resources upon navigation. The optimistic rendering shows the data already loaded during loading, but a few seconds after navigating to an Edit view, the up-to-date data is there. – François Zaninotto Apr 06 '17 at 14:04

0 Answers0