<commit_before>import Ember from "ember";
import { containingElement } from "liquid-fire/ember-internals";

var get = Ember.get;
var set = Ember.set;

export default Ember.Component.extend({
  tagName: "",
  name: 'liquid-versions',

  appendVersion: Ember.on('init', Ember.observer('value', function() {
    var versions = get(this, 'versions');
    var firstTime = false;
    var newValue = get(this, 'value');
    var oldValue;

    if (!versions) {
      firstTime = true;
      versions = Ember.A();
    } else {
      oldValue = versions[0];
    }

    // TODO: may need to extend the comparison to do the same kind of
    // key-based diffing that htmlbars is doing.
    if ((!oldValue && !newValue) ||
        (oldValue  === newValue)) {
      return;
    }

    this.notifyContainer('willTransition', versions);
    var newVersion = {
      value: newValue,
      shouldRender: newValue || get(this, 'renderWhenFalse')
    };
    versions.unshiftObject(newVersion);<commit_msg>empty value still counts as first render<commit_after>import Ember from "ember";
import { containingElement } from "liquid-fire/ember-internals";

var get = Ember.get;
var set = Ember.set;

export default Ember.Component.extend({
  tagName: "",
  name: 'liquid-versions',

  appendVersion: Ember.on('init', Ember.observer('value', function() {
    var versions = get(this, 'versions');
    var firstTime = false;
    var newValue = get(this, 'value');
    var oldValue;

    if (!versions) {
      firstTime = true;
      versions = Ember.A();
    } else {
      oldValue = versions[0];
    }

    // TODO: may need to extend the comparison to do the same kind of
    // key-based diffing that htmlbars is doing.
    if ((!oldValue && !newValue) ||
        (oldValue  === newValue)) {
      if (firstTime) {
        set(this, 'versions', versions);
      }
      return;
    }

    this.notifyContainer('willTransition', versions);
    var newVersion = {
      value: newValue,
      shouldRender: newValue || get(this, 'renderWhenFalse')
    };
    versions.unshiftObject(newVersion);
{'fraction_non_alphanumeric': 0.13278609367455335, 'fraction_numerical': 0.0009657170449058426, 'mean_word_length': 2.9693486590038316, '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': '5272665', 'n_tokens_mistral': 641, 'n_tokens_neox': 622, 'n_words': 174}