Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
joetesta
Level 10

Component to use for lazy-loading?

Hello -

Is there a recommended component or method for lazy-loading a bunch of content items from a paginated feed?  

ie the feed takes an index parameter to indicate the start position within the full feed and loads say 20 items at a time, then the task to load more items would be triggered as the user navigates down or across the list.

tyvmia,
Joe
aspiring
0 Kudos
3 Replies
joetesta
Level 10

Re: Component to use for lazy-loading?

I have a bunch of ideas but hoping to not spend time spinning and reinventing wheels.
Could use a rowlist and add rows as the user goes down.  The numbering will be incorrect.  Will it be performant?
Could use a rowlist and populate nodes as the user scrolls right.
Could use various grid elements, markupGrid comes to mind, and add nodes (or populate pre-set invalid nodes?) as the user navigates?
Build a custom lazy loading grid component?

Thanks for any suggestions, tips, words of caution, encouragement; anything but hate mail.
cheers
aspiring
0 Kudos
Veeta
Level 7

Re: Component to use for lazy-loading?

If you have a categorical organization, meaning category per row, I would recommend not paginating items within the category but a full category at a time.  I haven't been able to successfully load a subset of row data within any of the RowList-like components.  From SDK1, roGridScreen a SetContentListSubset() to accomplish this.  

Some experiments from last year gave the best experience by using replaceChild() on the root content node to replace a previously empty (i.e. unloaded) category with a populated one downloaded by a background task.

Some other notes:
- if you can avoid writing a fully custom component, it'll save you tons of work and poor performance on older devices.  These devices suffer every time they run brightscript callbacks vs. the built-in components which running natively.
- strategically manage the # of items you lazy load.  If the batch size is large, it can take a long time to convert to content nodes and rendezvous back to the render thread.  If the batch size is small, too many rendezvous will cause lag in the navigation.
0 Kudos
joetesta
Level 10

Re: Component to use for lazy-loading?

Thank you very much for your feedback Veeta.
My thought about the rowlists was to create empty nodes and set their values later, but didn't try that yet.
Now I'm thinking to use a PosterGrid if I can get away with the simplicity, otherwise MarkupGrid.  I'll see what I can figure out as far as loading paginated subsets.  Your advice is much appreciated!
aspiring
0 Kudos