juxscript 1.1.268 → 1.1.269
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageState.d.ts","sourceRoot":"","sources":["../../../lib/state/pageState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pageState.d.ts","sourceRoot":"","sources":["../../../lib/state/pageState.ts"],"names":[],"mappings":"AAeA,cAAM,SAAS;IACX,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,MAAM,CAAsB;IAEpC,MAAM,CAAC,QAAQ,CAAC,WAAW,2IAOhB;;IA2BX,OAAO,CAAC,qBAAqB;IAyD7B,OAAO,CAAC,SAAS;IA6CjB,OAAO,CAAC,UAAU;IAwBlB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,OAAO;IAqBf,OAAO,CAAC,MAAM;IAcd,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGlC;AAID,eAAO,MAAM,SAAS,qBAAuB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Tracks which reactive block is currently running so we can record dependencies
|
|
2
2
|
let activeReaction = null;
|
|
3
3
|
const reactionDeps = new Map();
|
|
4
|
+
let notifyQueue = [];
|
|
5
|
+
let isNotifying = false;
|
|
4
6
|
class PageState {
|
|
5
7
|
constructor() {
|
|
6
8
|
this._registry = new Map();
|
|
@@ -167,11 +169,24 @@ class PageState {
|
|
|
167
169
|
this._registry.delete(id);
|
|
168
170
|
}
|
|
169
171
|
_notify(depKey) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
notifyQueue.push(depKey);
|
|
173
|
+
// Prevent re-entrant notification loops
|
|
174
|
+
if (isNotifying)
|
|
175
|
+
return;
|
|
176
|
+
isNotifying = true;
|
|
177
|
+
try {
|
|
178
|
+
while (notifyQueue.length > 0) {
|
|
179
|
+
const key = notifyQueue.shift();
|
|
180
|
+
for (const [reaction, deps] of reactionDeps.entries()) {
|
|
181
|
+
if (deps.has(key)) {
|
|
182
|
+
reaction();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
173
185
|
}
|
|
174
186
|
}
|
|
187
|
+
finally {
|
|
188
|
+
isNotifying = false;
|
|
189
|
+
}
|
|
175
190
|
}
|
|
176
191
|
_watch(fn) {
|
|
177
192
|
const reaction = () => {
|