Refresh data after 'update'

Hello Forest Admin Team,

Could you please advise, how can I refresh the data after the ‘update’ event?
It seems like Forest Admin UI doesn’t consider what is sent in PUT response data and this is fair enough. But in that case how I can refresh the data after PUT.

image

This is needed when I’m handling PUT request manually and preparing the data (changing) before saving. UI will show user input (which is different from the data that was prepared and saved) and there is no way to show actual saved data since GET request is not triggered immediately.

Expected behavior

PUT + GET or consider the data from the response on PUT request.

Actual behavior

Only PUT is triggered. Didn’t find a way to refresh the data right after updating (except refreshing the page).

Context

CRUD Operations (PUT enhancements).

Hi @slow_monkey

I just checked on my side and it seems to work, but I may have missed something. Here is what I tried:

  1. I updated a route of one of my models
router.put('/customers/:recordId', permissionMiddlewareCreator.update(), (request, response, next) => {
  request.body.data.attributes.avatar = 'MY NEW VALUE';
  next();
});
  1. Then I restarted my backend and tried to edit from the interface (detailed view and table view) and it worked (i.e data is refreshed)

Demo below:

ezgif.com-video-to-gif (10)

I may have missed something. Could you post a simplified example of your code so I could reproduce the issue?

Hello,

Indeed, with primitive types, it works perfectly fine. But I have an array of integers (tuple with min-max range).

Structure field code:

time: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
},

Route code:

image.png

Entered the range:

Result (shows previous value, not saved value, and not even value that was recently entered):

After page refresh, it shows the value set in the route handler.
Could you please check?

Kind regards,
Mark

1 Like

Hi @slow_monkey :wave:, thank you for your feedback, I’m able to reproduce.
I will transfert to the team and work on a fix

Hello @Arnaud_Moncel, any updates on this topic?

Kind regards,
Mark

Hi @slow_monkey,
Here is the ticket, the team is currently working on this:

We will let you know once it is released :pray:

Got it, thanks!

Kind regards,
Mark

Hi @slow_monkey,

A fix for the issue you reported should have been released now.

Let us know is you experience any casualties regarding this concern.

Best regards

Hello,

It seems working well. Thank you!

Kind regards,
Mark

1 Like