@knotx/data 0.2.10 → 0.2.11

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.
package/dist/index.cjs CHANGED
@@ -115,6 +115,9 @@ class DataManager {
115
115
  return this.operations$.asObservable();
116
116
  }
117
117
  dispatch(operation) {
118
+ if (operation.type === "batch" && operation.operations.length === 0) {
119
+ return;
120
+ }
118
121
  this.operations$.next(operation);
119
122
  }
120
123
  getDraftDataList(draftId) {
@@ -231,9 +234,7 @@ class DataManager {
231
234
  if (operation.isDryRun) {
232
235
  return this.applyOperation(dataMap, { type: "batch", operations });
233
236
  }
234
- if (operations.length > 0) {
235
- this.dispatch({ type: "batch", operations });
236
- }
237
+ this.dispatch({ type: "batch", operations });
237
238
  this.drafts$.value.delete(operation.draftId);
238
239
  this.drafts$.next(this.drafts$.value);
239
240
  if (this.currentDraftDataMap$.value === draftData.value) {
package/dist/index.js CHANGED
@@ -113,6 +113,9 @@ class DataManager {
113
113
  return this.operations$.asObservable();
114
114
  }
115
115
  dispatch(operation) {
116
+ if (operation.type === "batch" && operation.operations.length === 0) {
117
+ return;
118
+ }
116
119
  this.operations$.next(operation);
117
120
  }
118
121
  getDraftDataList(draftId) {
@@ -229,9 +232,7 @@ class DataManager {
229
232
  if (operation.isDryRun) {
230
233
  return this.applyOperation(dataMap, { type: "batch", operations });
231
234
  }
232
- if (operations.length > 0) {
233
- this.dispatch({ type: "batch", operations });
234
- }
235
+ this.dispatch({ type: "batch", operations });
235
236
  this.drafts$.value.delete(operation.draftId);
236
237
  this.drafts$.next(this.drafts$.value);
237
238
  if (this.currentDraftDataMap$.value === draftData.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/data",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "Data for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/lodash-es": "^4.17.12",
36
- "@knotx/build-config": "0.2.10",
37
- "@knotx/eslint-config": "0.2.10",
38
- "@knotx/typescript-config": "0.2.10"
36
+ "@knotx/build-config": "0.2.11",
37
+ "@knotx/eslint-config": "0.2.11",
38
+ "@knotx/typescript-config": "0.2.11"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "unbuild",