Skip to content

Commit

Permalink
slightly more compact
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil committed Jul 17, 2024
1 parent 00e2cb8 commit 0e8d163
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,8 @@ export class PreviewServer {
this._dag.get(caller)!.add(path);
const seen = new Set<string>();
const q = [caller];
while (true) {
const node = q.shift();
if (!node) return;
while (q.length) {
const node = q.shift()!;
if (seen.has(node))
throw new Error(`${red("Circular dependency detected")}: ${[...seen, node].map(bold).join(" ← ")}`);
q.push(...(this._dag.get(node) ?? []));
Expand Down

0 comments on commit 0e8d163

Please sign in to comment.