firebase-element icon indicating copy to clipboard operation
firebase-element copied to clipboard

Conflict with array-selector when updating an item in firebase

Open albertolobrano opened this issue 9 years ago • 0 comments

When an item in firebase get's updated the components call the following code. The given code will call splices on the array which causes any selected item to be deselected.

_onFirebaseChildChanged: function(event) { this._applyRemoteDataChange(function() { var value = this._valueFromSnapshot(event.detail.childSnapshot); var oldValue = this._valueMap[value.firebaseKey];

      if (!oldValue) {
        this._error('Received firebase-child-changed event for unknown child "' + value.__firebaseKey__ + '"');
        return;
      }

      this._valueMap[oldValue.__firebaseKey__] = null;
      this._valueMap[value.__firebaseKey__] = value;
      this.splice('data', this.data.indexOf(oldValue), 1, value);
    });
  },

albertolobrano avatar Oct 29 '15 19:10 albertolobrano