Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C catalog.genesys-pgr.org
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Genesys PGR
  • Genesys Catalog
  • catalog.genesys-pgr.org
  • Issues
  • #254

Closed
Open
Created Feb 12, 2018 by Matija Obreza@mobrezaOwner

Almost infinite loader

When registering 10,000s of new DOM elements in the component the React event-loop becomes irresponsive. React virtualized is great, but mostly for tabular data where row heights are known and you have millions of items.

We now use a very simple approach to render list items:

{ paged.content.map((e) => (
 <Something key={ e.key } />
) ) }

New approach

Implement a new component ForeverLoader that will be used like this:

const renderItem = (item) => <DescriptorCard descriptor={ item } />;

<ForeverLoader paged={ paged } loadPage={ loadDescriptors }
   itemRenderer={ renderItem } 
   loadingIndicator={ <Loading /> }
/>

The ForeverLoader would initially take the paged.content list and use the itemRenderer function to add those elements to DOM.

When the user scrolls closer to the end of the rendered list (how do we detect that?), the loader loads the next page of data and adds those items to the DOM. That takes care of the React's event-loop (I hope), but memory use on the client side will be significant.

Implementation

  1. The loader needs to keep track of current items[] and also the pageSize and current page number.
  2. Loader "detects" that the user is scrolling towards end of available items[] and makes the API call for the next page.
  3. Whenever api call is in progress, the loadingIndicator is displayed as last element.
Assignee
Assign to
Time tracking