code: func (fic *fileItemContainer) render() error {
  	fic.mu.Lock()
  	defer fic.mu.Unlock()
  	if len(fic.items) == 0 {
  		return nil
  	}
  
  	fit := fic.current
  
  	needsUpdate := false
  	prepend := false
  	var around blob.Ref
  	if !fic.endReached && fic.currentIdx+1 >= len(fic.items)-1 {
  		needsUpdate = true
  		around = fic.items[len(fic.items)-1].pn
  	} else if !fic.beginningReached && fic.currentIdx <= 1 {
  		needsUpdate = true
  		prepend = true
  		around = fic.items[0].pn
  	}
  
  	c := make(chan error)
  	var sr *SearchResult
  	go func() {
  		var err error
  		if needsUpdate {
  			sr, err = fic.getPeers(around, 9)
  		}
  		c <- err
  	}()
  
  	// Do the main rendering work while waiting for getPeers
  	fit.setThumb(fic)
  	fit.setDownload(fic)
  	jQuery(ficDiv).Empty()
  	fic.refreshTitle()
  	fic.refreshLocation()
  	fit.render()
  
  	err := <-c
  	if err != nil {
  		return fmt.Errorf("cannot get peers of %v: %v", fit.pn, err)
  	}
  
  	if needsUpdate {
  		fic.updateItems(sr, around, prepend)
  	}
  
  	fic.refreshNav()
  	return nil
  }
docs: // TODO(mpl): optimization: it might be interesting to let render return as soon
  // as the actual rendering is done, and not have to wait for getPeers and
  // updateItems. But it would make locking more complicated, so later.