@domql/element 2.31.28 → 2.31.30

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.
@@ -56,11 +56,19 @@ const update = async function(params = {}, opts) {
56
56
  const { excludes, preventInheritAtCurrentState } = options;
57
57
  let ref = element.__ref;
58
58
  if (!ref) ref = element.__ref = {};
59
+ if (ref.__stormAbortion && !options.allowStorm) {
60
+ const stormAbortion = setTimeout(() => {
61
+ delete ref.__stormAbortion;
62
+ clearTimeout(stormAbortion);
63
+ }, 1e3);
64
+ return;
65
+ }
59
66
  if (this === options.calleeElement && !options.allowStorm) {
60
67
  if (ref.__selfCallIteration === void 0) ref.__selfCallIteration = 0;
61
68
  else ref.__selfCallIteration++;
62
69
  if (ref.__selfCallIteration > 100) {
63
70
  ref.__selfCallIteration = 0;
71
+ ref.__stormAbortion = true;
64
72
  return this.error("Potential self calling loop in update detected", opts);
65
73
  }
66
74
  const stormTimeout = setTimeout(() => {
@@ -50,11 +50,19 @@ const update = async function(params = {}, opts) {
50
50
  const { excludes, preventInheritAtCurrentState } = options;
51
51
  let ref = element.__ref;
52
52
  if (!ref) ref = element.__ref = {};
53
+ if (ref.__stormAbortion && !options.allowStorm) {
54
+ const stormAbortion = setTimeout(() => {
55
+ delete ref.__stormAbortion;
56
+ clearTimeout(stormAbortion);
57
+ }, 1e3);
58
+ return;
59
+ }
53
60
  if (this === options.calleeElement && !options.allowStorm) {
54
61
  if (ref.__selfCallIteration === void 0) ref.__selfCallIteration = 0;
55
62
  else ref.__selfCallIteration++;
56
63
  if (ref.__selfCallIteration > 100) {
57
64
  ref.__selfCallIteration = 0;
65
+ ref.__stormAbortion = true;
58
66
  return this.error("Potential self calling loop in update detected", opts);
59
67
  }
60
68
  const stormTimeout = setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.31.28",
3
+ "version": "2.31.30",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -27,12 +27,12 @@
27
27
  "prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/event": "^2.31.28",
31
- "@domql/render": "^2.31.28",
32
- "@domql/state": "^2.31.28",
33
- "@domql/utils": "^2.31.28"
30
+ "@domql/event": "^2.31.30",
31
+ "@domql/render": "^2.31.30",
32
+ "@domql/state": "^2.31.30",
33
+ "@domql/utils": "^2.31.30"
34
34
  },
35
- "gitHead": "62fc6275cd961fffd78b8f4c7474e10a61251c38",
35
+ "gitHead": "2cf6e94eae0ea19763d2acac8bebb9b640f4dceb",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.27.1"
38
38
  }
package/update.js CHANGED
@@ -66,6 +66,15 @@ export const update = async function (params = {}, opts) {
66
66
  let ref = element.__ref
67
67
  if (!ref) ref = element.__ref = {}
68
68
 
69
+ if (ref.__stormAbortion && !options.allowStorm) {
70
+ // make storm abourtion time based
71
+ const stormAbortion = setTimeout(() => {
72
+ delete ref.__stormAbortion
73
+ clearTimeout(stormAbortion)
74
+ }, 1000)
75
+ return
76
+ }
77
+
69
78
  // self calling is detected
70
79
  if (this === options.calleeElement && !options.allowStorm) {
71
80
  if (ref.__selfCallIteration === undefined) ref.__selfCallIteration = 0
@@ -73,6 +82,7 @@ export const update = async function (params = {}, opts) {
73
82
  // prevent storm
74
83
  if (ref.__selfCallIteration > 100) {
75
84
  ref.__selfCallIteration = 0
85
+ ref.__stormAbortion = true
76
86
  return this.error('Potential self calling loop in update detected', opts)
77
87
  }
78
88
  // make storm detection time based