Skip to content

Commit 33213b5

Browse files
committed
Fix bug in "skip canceling children" logic
1 parent e2eac2a commit 33213b5

File tree

1 file changed

+5
-2
lines changed
  • packages/action-listener-middleware/src

1 file changed

+5
-2
lines changed

packages/action-listener-middleware/src/job.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,18 @@ export class Job<T> implements JobHandle {
290290
) {
291291
const childrenCopy = [...this._children]
292292
const skipSet = new Set(skipChildren)
293+
const remainingChildren: typeof this._children = []
293294
childrenCopy.forEach((job) => {
294-
if (!skipSet.has(job)) {
295+
if (skipSet.has(job)) {
296+
remainingChildren.push(job)
297+
} else {
295298
job.cancel(
296299
reason ??
297300
new JobCancellationException(JobCancellationReason.JobCancelled)
298301
)
299302
}
300303
})
301-
this._children = []
304+
this._children = remainingChildren
302305
}
303306

304307
private _addChild(child: Job<any>) {

0 commit comments

Comments
 (0)