@aemforms/af-core 0.22.135 → 0.22.136

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.
@@ -1535,6 +1535,20 @@ class BaseNode {
1535
1535
  this.queueEvent(action);
1536
1536
  this.form.getEventQueue().runPendingQueue();
1537
1537
  }
1538
+ withDependencyTrackingControl(disableDependencyTracking, callback) {
1539
+ const currentDependencyTracking = this.form.ruleEngine.getDependencyTracking();
1540
+ if (disableDependencyTracking) {
1541
+ this.form.ruleEngine.setDependencyTracking(false);
1542
+ }
1543
+ try {
1544
+ return callback();
1545
+ }
1546
+ finally {
1547
+ if (disableDependencyTracking) {
1548
+ this.form.ruleEngine.setDependencyTracking(currentDependencyTracking);
1549
+ }
1550
+ }
1551
+ }
1538
1552
  notifyDependents(action) {
1539
1553
  const depsToRestore = this._jsonModel._dependents;
1540
1554
  if (depsToRestore) {
@@ -1548,7 +1562,9 @@ class BaseNode {
1548
1562
  }
1549
1563
  const handlers = this._callbacks[action.type] || [];
1550
1564
  handlers.forEach(x => {
1551
- x(new ActionImplWithTarget(action, this));
1565
+ this.withDependencyTrackingControl(true, () => {
1566
+ x(new ActionImplWithTarget(action, this));
1567
+ });
1552
1568
  });
1553
1569
  }
1554
1570
  isEmpty(value = this._jsonModel.value) {
@@ -84,6 +84,7 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
84
84
  abstract executeAction(action: Action): any;
85
85
  queueEvent(action: Action): void;
86
86
  dispatch(action: Action): void;
87
+ protected withDependencyTrackingControl<T>(disableDependencyTracking: boolean, callback: () => T): T;
87
88
  notifyDependents(action: Action): void;
88
89
  protected isEmpty(value?: any): boolean;
89
90
  _setProperty<T>(prop: string, newValue: T, notify?: boolean, notifyChildren?: (action: Action) => void): any;
package/lib/BaseNode.d.ts CHANGED
@@ -84,6 +84,7 @@ export declare abstract class BaseNode<T extends BaseJson> implements BaseModel
84
84
  abstract executeAction(action: Action): any;
85
85
  queueEvent(action: Action): void;
86
86
  dispatch(action: Action): void;
87
+ protected withDependencyTrackingControl<T>(disableDependencyTracking: boolean, callback: () => T): T;
87
88
  notifyDependents(action: Action): void;
88
89
  protected isEmpty(value?: any): boolean;
89
90
  _setProperty<T>(prop: string, newValue: T, notify?: boolean, notifyChildren?: (action: Action) => void): any;
package/lib/BaseNode.js CHANGED
@@ -330,6 +330,20 @@ class BaseNode {
330
330
  this.queueEvent(action);
331
331
  this.form.getEventQueue().runPendingQueue();
332
332
  }
333
+ withDependencyTrackingControl(disableDependencyTracking, callback) {
334
+ const currentDependencyTracking = this.form.ruleEngine.getDependencyTracking();
335
+ if (disableDependencyTracking) {
336
+ this.form.ruleEngine.setDependencyTracking(false);
337
+ }
338
+ try {
339
+ return callback();
340
+ }
341
+ finally {
342
+ if (disableDependencyTracking) {
343
+ this.form.ruleEngine.setDependencyTracking(currentDependencyTracking);
344
+ }
345
+ }
346
+ }
333
347
  notifyDependents(action) {
334
348
  const depsToRestore = this._jsonModel._dependents;
335
349
  if (depsToRestore) {
@@ -343,7 +357,9 @@ class BaseNode {
343
357
  }
344
358
  const handlers = this._callbacks[action.type] || [];
345
359
  handlers.forEach(x => {
346
- x(new ActionImplWithTarget(action, this));
360
+ this.withDependencyTrackingControl(true, () => {
361
+ x(new ActionImplWithTarget(action, this));
362
+ });
347
363
  });
348
364
  }
349
365
  isEmpty(value = this._jsonModel.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.135",
3
+ "version": "0.22.136",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.135"
40
+ "@aemforms/af-formatters": "^0.22.136"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",