<commit_before>/*****************************************************************************************************************
 *    VGridObservables
 *    Observers the vGridCollection/current entity for changes
 *    Created by <NAME>
 *
 ****************************************************************************************************************/
export class VGridObservables {


  constructor(vGrid, bindingEngine) {
    this.bindingEngine = bindingEngine;
    this.vGrid = vGrid;
    this.subscriptionsAttributes = []; //here I keep subscriptions to observer on attributes
    this.collectionSubscription = null; //here I keep subscriptions to observer on collection
    this.subscriptionsArray = []; //my property subscriptions
  }


  /***************************************************************************************
   * observer vGridCollection, when entire vGridCollection gets replaced
   ***************************************************************************************/
  enableObservablesCollection() {

    let collectionSubscription = (x, y) => {

      //disable array observer
      this.disableObservablesArray();

      //clone array
      //key will be set in both collection and internal since with slice we get a refrence
      this.vGrid.vGridCollectionFiltered = this.vGrid.vGridCollection.slice(0);
      this.vGrid.checkKeys();


      //reset filter/and collection/selection. (should I have option to check is they want to set something?)
      this.vGrid.vGridCurrentRow = -1;
      this.vGrid.vGridSort.reset();
      if(!this.vGrid.vGridConfig.keepFilterOnCollectionChange){
        //clear sort icons //todo improve with event
        this.vGrid.vGridSort.reset();
        this.vGrid.vGridGenerator.rebuildGridHeaderHtmlAndViewSlot();

        this.vGrid.vGridSelection.reset();
        this.vGrid.vGridConfig.keepFilterOnCollectionChange = false;
      }
      this.vGrid.vGridGenerator.collectionChange();

      //reset
      for (var k in this.vGrid.vGridCurrentEntity) {
        if (this.vGrid.vGridCurrentEntity.hasOwnProperty(k)) {
          this.vGrid.vGridCurrentEntity[k] = undefined;<commit_msg>fix(observer): array change did not clear currentEntityRef<commit_after>/*****************************************************************************************************************
 *    VGridObservables
 *    Observers the vGridCollection/current entity for changes
 *    Created by <NAME>
 *
 ****************************************************************************************************************/
export class VGridObservables {


  constructor(vGrid, bindingEngine) {
    this.bindingEngine = bindingEngine;
    this.vGrid = vGrid;
    this.subscriptionsAttributes = []; //here I keep subscriptions to observer on attributes
    this.collectionSubscription = null; //here I keep subscriptions to observer on collection
    this.subscriptionsArray = []; //my property subscriptions
  }


  /***************************************************************************************
   * observer vGridCollection, when entire vGridCollection gets replaced
   ***************************************************************************************/
  enableObservablesCollection() {

    let collectionSubscription = (x, y) => {

      //disable array observer
      this.disableObservablesArray();

      //clone array
      //key will be set in both collection and internal since with slice we get a refrence
      this.vGrid.vGridCollectionFiltered = this.vGrid.vGridCollection.slice(0);
      this.vGrid.checkKeys();


      //reset filter/and collection/selection. (should I have option to check is they want to set something?)
      this.vGrid.vGridCurrentRow = -1;

      this.vGrid.vGridSort.reset();
      if(!this.vGrid.vGridConfig.keepFilterOnCollectionChange){
        //clear sort icons //todo improve with event
        this.vGrid.vGridSort.reset();
        this.vGrid.vGridGenerator.rebuildGridHeaderHtmlAndViewSlot();

        this.vGrid.vGridSelection.reset();
        this.vGrid.vGridConfig.keepFilterOnCollectionChange = false;
      }
      this.vGrid.vGridGenerator.collectionChange();

      //reset
      this.vGrid.vGridCurrentEntityRef = null;
      for (var k in this.vGrid.vGridCurrentEntity) {
        if (this.vGrid.vGridCurrentEntity.hasOwnProperty(k)) {
          this.vGrid.vGridCurrentEntity[k] = undefined;
{'fraction_non_alphanumeric': 0.25583503285746656, 'fraction_numerical': 0.0009064128710627691, 'mean_word_length': 4.056128293241695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4017535', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1019, 'n_words': 251}