29
Views
14
Comments
After ajax refresh webblock displays outdated information

Hi,

We have a webblock with a structure list as an input parameter. After doing the necessary data updates we:

1 - click the save button;

2 - the save screen action is called; which will save the data via a REST API method and then trigger a notify;

3 - in the parent webscreen onnotfy action linked to the webblock we retrieve the latest data via the an REST API method; 

4 - we assign the output of the API to the list that is used in the webblock as an input parameter and then refresh the webblock;

Problem: We don't see the updated data;

What we've noticed: In debug mode we will see the updated information or if we refresh the screen after a couple of seconds;


Any suggestions on how to overcome this?

Thanks in advance.

Rank: #204

Hi Ricardo, are you refresh the widgets to reload with the new data?

This is Traditional Web or Reactive? Can you update the oml?

Rank: #81

Hi Ricardo, 

Call CommitTransaction action after you save the data.

it will solve the issue.

Hi again,

It's a traditional web app (OS 10) and yes I can update the OML. I will try commiting the transaction and if it works I'll be sure to mark it as the solution. Thanks

Morning,

I tried commiting the transaction and it unfortunately did not work. I was also sceptical as I believe APIs have parallel transactions - as you mentioned Carlos.

I will keep on trying however if someone else has any other suggestions please feel free to share them.


Regards,

Ricardo

Rank: #204

Ricardo de Freitas wrote:

Hi,

We have a webblock with a structure list as an input parameter. After doing the necessary data updates we:

1 - click the save button;

2 - the save screen action is called; which will save the data via a REST API method and then trigger a notify;

3 - in the parent webscreen onnotfy action linked to the webblock we retrieve the latest data via the an REST API method; 

4 - we assign the output of the API to the list that is used in the webblock as an input parameter and then refresh the webblock;

Problem: We don't see the updated data;

What we've noticed: In debug mode we will see the updated information or if we refresh the screen after a couple of seconds;


Any suggestions on how to overcome this?

Thanks in advance.

BTW after you complete your flow you, leave the page and come back, check if the date is updated? if yes is some widget you arent refreshing in the screen


Good idea but I don't think that is the problem, if it was then it wouldn't even work in debug mode. 

Rank: #81

Hi folks, 

I came acrossa quite similar case where I was saving sime data n then calling a Rest Api of another module. And the issue which I was facing is the data which I stored before calling api was not getting reflect when the action under Rest Api execute.

And hence using the CommitTransaction in my case before calling Rest, helped me.



Ok after lots of trial and error I tried adding a small timeout after saving the data which of course is not a reliable solution. With the timeout the data was presented correctly after the AJAX refresh. Spoke to the API team and seems that they save things asynchronously (even though it take less than a second). So mystery solved as to why it's happening, however I still don't know how to overcome this without using a timeout...

Rank: #81

Happy to know :) You fixed the same.

Perhaps an interesting usecase.

Thanks Ricardo & Carlos