Scalability Suggestions Translation

Scalability Suggestions Translation

  

I am still new to OS.  I get this suggestion

"Scalability Suggestion
'PunchByDay' block is being iterated, which generates several requests to the server or local storage to fetch data. Consider fetching the data first and passing it to the block using input parameters to avoid latency problems.

I do not know what it means.  Can someone translate for me or give an example

Thanks

Andy

Hi Andy,

You are using a Block (called PunchByDay) in a List, and that block has an Aggregate (or Data Action).

This means that every time an instance of the block is displayed it will perform an individual data fetch. This has a toll in performance, so the suggestion is you fetch the data for all instances of the block at once, in a single aggregate (better performance), and then just pass the right data as input parameter to each block

Hope this helps!

I am using the same code that is in the Movie app example.  It takes punch card data entered on a different page and allows the user to view by date using the expandable section widget.  Would I be better off to not use a block?

Using a Block or not is not the issue really, fetching lots of data in small independent chunks might be... that's why the suggestion is to pass the data to the block instead of fetching it when the block is going to be displayed.

It is a suggestion, not allows possible or relevant to follow, will always depend on the scenario. If it's a small list it might not be relevant, if it's a long list, then you definitely would be better off fetching the whole dataset in one go and feeding individual data to the Block.