(adapter.js) didSaveRecord's payload should only be called if record isn't deleted. #807

Closed
juan77 opened this Issue Mar 14, 2013 · 2 comments

Projects

None yet

2 participants

@juan77
juan77 commented Mar 14, 2013

We need to avoid calling payload after deleting a record, because causes to be loaded again.

so in if (payload) we need to change to if (payload && !record.get('isDeleted'))

didSaveRecord: function(store, type, record, payload) {
    store.didSaveRecord(record);

    var serializer = get(this, 'serializer'),
        mappings = serializer.mappingForType(type);

    serializer.eachEmbeddedRecord(record, function(embeddedRecord, embeddedType) {
      if (embeddedType === 'load') { return; }

      this.didSaveRecord(store, embeddedRecord.constructor, embeddedRecord);
    }, this);

    if (payload && !record.get('isDeleted')) {
      var loader = DS.loaderFor(store);
      serializer.extract(loader, payload, type);
    }
  }
@wagenet
Member
wagenet commented Aug 10, 2013

@juan77 Can you send a PR for this along with a failing test?

@wagenet
Member
wagenet commented Oct 13, 2013

Closing due to inactivity and since this may be fixed in the 1.0 beta. Let me know if this is still an issue.

@wagenet wagenet closed this Oct 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment