Skip to content
This repository

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

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

2 participants

juan77 Peter Wagenet
juan77

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);
    }
  }
Peter Wagenet
Owner

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

Peter Wagenet
Owner

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

Peter Wagenet wagenet closed this October 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.