var grid = $('#picture_grid');

<% @pictures.each do |picture| %>
  grid.append('<%= j render picture %>');
<% end %>

$('#gallery .pagination').html('<%= j render 'pagination_links' %>');

$(document).trigger('content:update');

var grid = $('#picture_grid');
var pictures = [];

<% @pictures.each do |picture| %>
  var picture = $('<%= j render picture %>');
  grid.append(picture);
  pictures.push(picture);
<% end %>

$('#gallery .pagination').html('<%= j render 'pagination_links' %>');

$(document).trigger('content:update');

if (typeof ReactRailsUJS !== 'undefined') {
  pictures.forEach(function (picture) {
    ReactRailsUJS.mountComponents(picture);
  });
}

Fix endless scrolling in client encrypted galleries
Fix endless scrolling in client encrypted galleries
