Comparing version 3.0.1 to 3.1.0
@@ -93,3 +93,4 @@ var __defProp = Object.defineProperty; | ||
if (isRunning) { | ||
throw new Error(`[Quarx]: Circular dependency detected in ${name}`); | ||
const trace = [...stack.map(({name: name2}) => name2), name]; | ||
throw new Error(`[Quarx]: Circular dependency detected: ${trace.join(" -> ")}`); | ||
} | ||
@@ -100,7 +101,11 @@ if (seqNo === sequenceNumber) | ||
return run(); | ||
stack.push({name}); | ||
for (let dep of dependencies) { | ||
dep.actualize(); | ||
if (!seqNo) | ||
return run(); | ||
break; | ||
} | ||
stack.pop(); | ||
if (!seqNo) | ||
return run(); | ||
seqNo = sequenceNumber; | ||
@@ -112,3 +117,3 @@ } | ||
dependencies = new Set(); | ||
stack.push({link, invalidate, actualize}); | ||
stack.push({link, invalidate, actualize, name}); | ||
tryCatch(computation, onError); | ||
@@ -160,3 +165,3 @@ stack.pop(); | ||
function untracked(fn) { | ||
stack.push(null); | ||
stack.push({name: "[untracked]"}); | ||
try { | ||
@@ -163,0 +168,0 @@ return fn(); |
@@ -7,3 +7,3 @@ { | ||
"name": "quarx", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Simple dependency graph engine, MobX inspired", | ||
@@ -10,0 +10,0 @@ "main": "dist/index.js", |
@@ -88,3 +88,4 @@ const stack = []; | ||
if (isRunning) { | ||
throw new Error(`[Quarx]: Circular dependency detected in ${name}`); | ||
const trace = [...stack.map(({ name }) => name), name]; | ||
throw new Error(`[Quarx]: Circular dependency detected: ${trace.join(' -> ')}`); | ||
} | ||
@@ -94,6 +95,12 @@ if (seqNo === sequenceNumber) return; | ||
stack.push({ name }); | ||
for (let dep of dependencies) { | ||
dep.actualize(); | ||
if (!seqNo) return run(); | ||
if (!seqNo) break; | ||
} | ||
stack.pop(); | ||
if (!seqNo) return run(); | ||
seqNo = sequenceNumber; | ||
@@ -108,3 +115,3 @@ } | ||
stack.push({ link, invalidate, actualize }); | ||
stack.push({ link, invalidate, actualize, name }); | ||
@@ -168,3 +175,3 @@ tryCatch(computation, onError); | ||
export function untracked(fn) { | ||
stack.push(null); | ||
stack.push({ name: '[untracked]' }); | ||
try { | ||
@@ -171,0 +178,0 @@ return fn(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20050
460