Skip to content

Commit

Permalink
Render many more loading placeholders than required in Media List
Browse files Browse the repository at this point in the history
Previously enough loading placeholders were rendered to cover the end of the row. However, users were reporting that the external media library loading was slow. After discussion design input suggested loading lots of placeholders than necessary would improve the perception of speed. This has been implemented.

See
* #22681
* #25581
  • Loading branch information
jakejones1984 committed Jun 26, 2018
1 parent 4bc13c2 commit b2cce25
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/my-sites/media-library/list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ export class MediaLibraryList extends React.Component {

renderLoadingPlaceholders = () => {
const itemsPerRow = this.getItemsPerRow();
// Factor is added in response to users reporting that photos appeared
// to take a long time to load. More indicators are loaded than are necessary
// as this improves the perception of speed for the user
const factor = 4;
const itemsVisible = ( this.props.media || [] ).length;
const placeholders = itemsPerRow - ( itemsVisible % itemsPerRow );
const placeholders = itemsPerRow * factor - ( itemsVisible % itemsPerRow );

// We render enough placeholders to occupy the remainder of the row
return Array.apply( null, new Array( placeholders ) ).map( function( value, i ) {
Expand Down

0 comments on commit b2cce25

Please sign in to comment.