thunderous 2.3.4 → 2.3.5

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
@@ -87,11 +87,15 @@ var createSignal = (initVal, options) => {
87
87
  if (!isBatchingUpdates) {
88
88
  isBatchingUpdates = true;
89
89
  queueMicrotask(() => {
90
- for (const fn of updateQueue) {
91
- try {
92
- fn();
93
- } catch (error) {
94
- console.error("Error in subscriber:", { error, oldValue, newValue, fn });
90
+ while (updateQueue.size > 0) {
91
+ const updates = Array.from(updateQueue);
92
+ updateQueue.clear();
93
+ for (const fn of updates) {
94
+ try {
95
+ fn();
96
+ } catch (error) {
97
+ console.error("Error in subscriber:", { error, oldValue, newValue, fn });
98
+ }
95
99
  }
96
100
  }
97
101
  if (options?.debugMode === true || setterOptions?.debugMode === true) {
@@ -106,7 +110,6 @@ var createSignal = (initVal, options) => {
106
110
  }
107
111
  console.log("Signal set:", { oldValue, newValue, subscribers, label });
108
112
  }
109
- updateQueue.clear();
110
113
  isBatchingUpdates = false;
111
114
  });
112
115
  }
package/dist/index.js CHANGED
@@ -52,11 +52,15 @@ var createSignal = (initVal, options) => {
52
52
  if (!isBatchingUpdates) {
53
53
  isBatchingUpdates = true;
54
54
  queueMicrotask(() => {
55
- for (const fn of updateQueue) {
56
- try {
57
- fn();
58
- } catch (error) {
59
- console.error("Error in subscriber:", { error, oldValue, newValue, fn });
55
+ while (updateQueue.size > 0) {
56
+ const updates = Array.from(updateQueue);
57
+ updateQueue.clear();
58
+ for (const fn of updates) {
59
+ try {
60
+ fn();
61
+ } catch (error) {
62
+ console.error("Error in subscriber:", { error, oldValue, newValue, fn });
63
+ }
60
64
  }
61
65
  }
62
66
  if (options?.debugMode === true || setterOptions?.debugMode === true) {
@@ -71,7 +75,6 @@ var createSignal = (initVal, options) => {
71
75
  }
72
76
  console.log("Signal set:", { oldValue, newValue, subscribers, label });
73
77
  }
74
- updateQueue.clear();
75
78
  isBatchingUpdates = false;
76
79
  });
77
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thunderous",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",