<commit_before>import Component from '@ember/component';
import { inject as service } from '@ember/service';
import InfiniteScrollMixin from 'ember-cli-infinite-scroll/mixins/infinite-scroll';

/**
 A component that contains infinite scrolled content.

 @class InfiniteScrollContainerComponent
 @uses InfiniteScrollMixin
 @uses DS.Store
 */

export default Component.extend(InfiniteScrollMixin, {
  classNames: 'infinite-scroll-container',

  /**
   {{#crossLink "DS.Store"}}{{/crossLink}}
   */

  store: service(),

  /**
   Will be passed into the scroll listener to be the observed element on scroll.

   @property scrollContainer
   @type { String }
   @default '.infinite-scroll-container'
   */

  scrollContainer: '.infinite-scroll-container',

  /**
   Starts the infinite query.

   @method didReceiveAttrs
   */

  didReceiveAttrs() {
    this.infiniteQuery();
  },

  /**
   Record processing or anything else that needs to happen with the returned
   records.

   @method afterInfiniteQuery
   @param  newRecords { Object } the records returned in this cycle
   */

  afterInfiniteQuery(newRecords) {
    let content = newRecords && newRecords.get('content');
    if (!content) {
      content = newRecords;
    }
    let infiniteContentPropertyName = this.get('infiniteContentPropertyName');
    let model = this.get(infiniteContentPropertyName);

    if (model) {
      model.addObjects(content);
    } else {
      this.set(infiniteContentPropertyName, newRecords);
    }
  }
});<commit_msg>Another safeset<commit_after>import Component from '@ember/component';
import { inject as service } from '@ember/service';
import InfiniteScrollMixin from 'ember-cli-infinite-scroll/mixins/infinite-scroll';
import { safeSet } from '../utils/object';

/**
 A component that contains infinite scrolled content.

 @class InfiniteScrollContainerComponent
 @uses InfiniteScrollMixin
 @uses DS.Store
 */

export default Component.extend(InfiniteScrollMixin, {
  classNames: 'infinite-scroll-container',

  /**
   {{#crossLink "DS.Store"}}{{/crossLink}}
   */

  store: service(),

  /**
   Will be passed into the scroll listener to be the observed element on scroll.

   @property scrollContainer
   @type { String }
   @default '.infinite-scroll-container'
   */

  scrollContainer: '.infinite-scroll-container',

  /**
   Starts the infinite query.

   @method didReceiveAttrs
   */

  didReceiveAttrs() {
    this.infiniteQuery();
  },

  /**
   Record processing or anything else that needs to happen with the returned
   records.

   @method afterInfiniteQuery
   @param  newRecords { Object } the records returned in this cycle
   */

  afterInfiniteQuery(newRecords) {
    let content = newRecords && newRecords.get('content');
    if (!content) {
      content = newRecords;
    }
    let infiniteContentPropertyName = this.get('infiniteContentPropertyName');
    let model = this.get(infiniteContentPropertyName);

    if (model) {
      model.addObjects(content);
    } else {
      safeSet(this, infiniteContentPropertyName, newRecords);
    }
  }
});
{'fraction_non_alphanumeric': 0.1106396866840731, 'fraction_numerical': 0.0, 'mean_word_length': 3.6299093655589125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2549328', 'n_tokens_mistral': 885, 'n_tokens_neox': 853, 'n_words': 228}