dataflux 1.21.0 → 1.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,18 +134,23 @@ var PersistentStore = exports["default"] = /*#__PURE__*/function (_Store) {
134
134
  });
135
135
  });
136
136
  _defineProperty(_this, "_saveByType", function (type, ifLoaded) {
137
- _this.pubSub.publish("save", {
138
- status: "start",
139
- model: type
140
- });
141
137
  return _this.getDiff(type, ifLoaded).then(function (diff) {
142
- return _this._saveDiff(type, diff);
143
- }).then(function (data) {
144
- _this.pubSub.publish("save", {
145
- status: "end",
146
- model: type
138
+ var someChanges = diff.inserted.length > 0 || diff.updated.length > 0 || diff.deleted.length > 0;
139
+ if (someChanges) {
140
+ _this.pubSub.publish("save", {
141
+ status: "start",
142
+ model: type
143
+ });
144
+ }
145
+ return _this._saveDiff(type, diff).then(function (data) {
146
+ if (someChanges) {
147
+ _this.pubSub.publish("save", {
148
+ status: "end",
149
+ model: type
150
+ });
151
+ }
152
+ return data;
147
153
  });
148
- return data;
149
154
  });
150
155
  });
151
156
  _defineProperty(_this, "delayedSave", function () {