P
P
Pavel2016-03-27 18:48:47
JavaScript
Pavel, 2016-03-27 18:48:47

Why does backbone send all model attributes when save(attr, {patch: true})?

// внутри конструктора модели
  initialize : function() {
    this.on('change', function() {
      console.warn(this.changed);
      this.save(this.changed, {patch: true})
    });
  },

Actually, this.changedone pair is issued {атрибут : "значение"}, which I want to update for a specific model.
In theory, since the backbone realized that I only want to update the model, I pass one attribute to it, then it should send only it + id (perhaps, if there is a specific pseudo-url that identifies this model, id is not needed) .
Moreover, on the Russian documentation site, he also sends the entire model, despite the explicitly specified key-value pair.

Since I am new to backbone, before editing it myself, I would like to clarify, maybe something has already been implemented, but I just didn’t include the flag which one?
Thank you.

PS: why am I suffering this crap? got mineupdate/patchrequest and rejoice, you say. But the intranet system has the property of a large number of peak loads, where every byte counts. And the server is too weak, so you need to minify the amount of transferred data as soon as possible + clients can sit on dialup and such a request is also critical for them.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question