<commit_before>YUI.add('grid-view', function (Y) {

Y.GridView = Y.Base.create('gridView', Y.View, [], {

    template     : Y.Handlebars.compile(Y.one('#grid-template').getContent()),
    photoTemplate: Y.Handlebars.compile(Y.one('#grid-photo-template').getContent()),

    events: {
        '.photo': {click: 'select'}
    },

    initializer: function (config) {
        var photos = this.get('modelList');

        photos.after('reset', this.render, this);

        this.loadingNode     = null;
        this._maxKnownHeight = 0;

        this.publish('more', {preventable: false});

        Y.one('win').on(['scroll', 'resize'], this.more, this);
    },

    create: function () {
        return Y.Node.create('<div id="photos" />');
    },

    render: function () {
        var photos    = this.get('modelList'),
            container = this.get('container');

        container.setContent(this.template({
            photos: photos.map(function (photo) {
                return {
                    clientId: photo.get('clientId'),
                    pageUrl : '/photo/' + photo.get('id') + '/',
                    thumbUrl: photo.get('thumbUrl')
                };
            })
        }, {
            partials: {photo: this.photoTemplate}
        }));

        this.loadingNode = container.one('.loading');

        Y.later(1, this, 'more');

        return this;
    },

    more: function (e) {<commit_msg>Fixed bug with GridView loading duplicate photos on initial load.<commit_after>YUI.add('grid-view', function (Y) {

Y.GridView = Y.Base.create('gridView', Y.View, [], {

    template     : Y.Handlebars.compile(Y.one('#grid-template').getContent()),
    photoTemplate: Y.Handlebars.compile(Y.one('#grid-photo-template').getContent()),

    events: {
        '.photo': {click: 'select'}
    },

    initializer: function (config) {
        var photos = this.get('modelList');

        photos.after('reset', this.render, this);

        this.loadingNode     = null;
        this._maxKnownHeight = 0;

        this.publish('more', {preventable: false});

        Y.one('win').on(['scroll', 'resize'], this.more, this);
    },

    create: function () {
        return Y.Node.create('<div id="photos" />');
    },

    render: function () {
        var photos    = this.get('modelList'),
            container = this.get('container'),
            content;

        content = this.template({
            photos: photos.map(function (photo) {
                return {
                    clientId: photo.get('clientId'),
                    pageUrl : '/photo/' + photo.get('id') + '/',
                    thumbUrl: photo.get('thumbUrl')
                };
            })
        }, {
            partials: {photo: this.photoTemplate}
        });

        container.setContent(content);
        this.loadingNode = container.one('.loading');

        // Only try to load more photos if we already have some photos. This
        // prevents the lazily-loaded photos from duplicating.
        if (!photos.isEmpty()) {
            Y.later(1, this, 'more');
        }

        return this;
    },

    more: function (e) {
{'fraction_non_alphanumeric': 0.16374082349186084, 'fraction_numerical': 0.0012767315671879987, 'mean_word_length': 1.9454887218045114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1169638', 'n_tokens_mistral': 913, 'n_tokens_neox': 863, 'n_words': 175}