Skip to content

Commit 87b0ce1

Browse files
committed
avoid mutation during iteration when resolving pending waitpoints
1 parent c36e274 commit 87b0ce1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/core/src/v3/runtime/sharedRuntimeManager.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,14 @@ export class SharedRuntimeManager implements RuntimeManager {
259259
}
260260

261261
private resolvePendingWaitpoints(): void {
262-
for (const [resolverId, waitpoint] of this.waitpointsByResolverId.entries()) {
262+
// Clone keys first to avoid mutation-during-iteration hazards
263+
for (const resolverId of Array.from(this.waitpointsByResolverId.keys())) {
264+
const waitpoint = this.waitpointsByResolverId.get(resolverId);
265+
266+
if (!waitpoint) {
267+
continue;
268+
}
269+
263270
this.resolveWaitpoint(waitpoint, resolverId);
264271
}
265272
}

0 commit comments

Comments
 (0)