-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't mutate arrays while iterating
This cropped up in a much more complicated codebase at work. Haven't nailed down an actual repro specimen yet but verified this change works there. Issue was that the outgoing array was being iterated with a .forEach but inside of the loop .removeDependency was being called and that mutates the array. This mean that not all entries in the array would be iterated, leading to incorrect chunking results. Fix is simple, since dependency-graph already does the right thing and cleans up dependencies when removing a node I can get rid of all my manual cleanup code and just call .removeNode when done iterating.
- Loading branch information
Showing
7 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,9 @@ | |
|
||
color: aqua; | ||
} | ||
|
||
.a2 { | ||
composes: shared2 from "./shared2.css"; | ||
|
||
color: azure; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,9 @@ | |
|
||
color: blue; | ||
} | ||
|
||
.b2 { | ||
composes: shared3 from "./shared3.css"; | ||
|
||
color: blanchedalmond; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
.c { | ||
color: cyan; | ||
} | ||
|
||
.c2 { | ||
composes: shared2 from "./shared2.css"; | ||
|
||
color: crimson; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.shared2 { | ||
color: sandybrown; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.shared3 { | ||
color: saddlebrown; | ||
} |