Skip to content

Commit c26292d

Browse files
committed
fix: dont throw when dependent file node is missing
1 parent aa2c821 commit c26292d

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.changeset/yellow-cycles-carry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hot-hook": patch
3+
---
4+
5+
Don't throw when a dependent file node is missing. This can happen when a file has been deleted

packages/hot_hook/src/dependency_tree.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ export default class DependencyTree {
115115
const currentPath = queue.pop()!
116116
if (!invalidatedFiles.has(currentPath)) {
117117
const node = this.#pathMap.get(currentPath)
118-
if (!node) throw new Error(`Node ${currentPath} does not exist`)
118+
if (!node) continue
119+
119120
node.version++
120121
invalidatedFiles.add(currentPath)
121122
queue.push(...Array.from(node.dependents).map((n) => n.path))

0 commit comments

Comments
 (0)