Skip to content

Commit

Permalink
Turbopack HMR: Avoid infinite loops caused by cycles between modules …
Browse files Browse the repository at this point in the history
…in the dependency chain. (#8210)

Previously, if a change were made in a module that participated in a
dependency cycle, gathering affected modules would loop infinitely. This
check prevents this.

Test Plan: Fixes vercel/next.js#65537
  • Loading branch information
wbinnssmith committed May 28, 2024
1 parent 4a36547 commit 1446abf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,11 @@ function getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {
const { moduleId, dependencyChain } = nextItem;

if (moduleId != null) {
if (outdatedModules.has(moduleId)) {
// Avoid infinite loops caused by cycles between modules in the dependency chain.
continue;
}

outdatedModules.add(moduleId);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1446abf

Please sign in to comment.