Best practice to fetch data from other source as client action?

Best practice to fetch data from other source as client action?

  

Hi,

On mobile apps what is the recommended way to have functionality similar to "fetch data from other source" but for client actions? 

We have a client actions that returns a list that is used on multiple screens. Currently to call that action I'm using a dummy aggregate on local storage and call action in OnAfterFetch action. 


Mykola (Nick) Tkachenko wrote:

Hi,

On mobile apps what is the recommended way to have functionality similar to "fetch data from other source" but for client actions? 

We have a client actions that returns a list that is used on multiple screens. Currently to call that action I'm using a dummy aggregate on local storage and call action in OnAfterFetch action. 


Hello Mykola,

Where exactly is the data coming from? Server database?

You could consider synching that data to your local storage, then fetching it normally in each screen. 

By fetching data with those screen aggregates, Outsystems optimizes the process starting to get data around the time the OnInitialize event fires. Given this, I guess that is your best option for performance. 

Best regards,

Daniel


Hi Daniel,

Data is already on local entities, but for this particular situation one aggregate is not enough so it has to be a client action. Exactly for the reason aggregates are running in parallels with rendering I use it in on after fetch event of a dummy aggregate. But it looks not elegant and needs some commenting for other developers when passing a project along or growing the team. 

Mykola,

Why isn't one aggregate enough? You mean, you have to further process the data after fetching it?

If you really can't just use the aggregate, I guess unfortunately there's no 'pretty solution'. 

Currently I'm working on a mobile project in wich we had to do some workarounds like yours. But as long as you fill in the descriptions right, I think it won't be too hard for other developers to get it.

On the other hand, it can impact the screens loading time. If so, provide the user a visual feedback while loading, and since you are showing a list (I'm guessing), load just a few elements at a time. 

Regards,

Daniel