Skip to content

Commit b206d08

Browse files
author
Felix Schlitter
committed
Check if step has changed since since enqueuing RELEASE
1 parent 82a0810 commit b206d08

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Effect/Aff.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ var Aff = function () {
455455
result = util.fromRight(step);
456456
// We need to enqueue the Release with the same interrupt
457457
// status as the Bracket that is initiating it.
458-
attempts = new Aff(CONS, new Aff(RELEASE, attempt._2, result), attempts, tmp);
458+
attempts = new Aff(CONS, new Aff(RELEASE, attempt._2, step), attempts, tmp);
459459
// We should only coninue as long as the interrupt status has not changed or
460460
// we are currently within a non-interruptable finalizer.
461461
if (interrupt === tmp || bracketCount > 0) {
@@ -474,16 +474,17 @@ var Aff = function () {
474474
// since we enqueued the item, and the bracket count is 0. If the
475475
// bracket count is non-zero then we are in a masked state so it's
476476
// impossible to be killed.
477+
var v = util.fromRight(attempt._2);
477478
if (interrupt && interrupt !== tmp && bracketCount === 0) {
478-
if (step == null || util.isLeft(step)) {
479-
step = attempt._1.killed(util.fromLeft(interrupt))(attempt._2);
479+
if (step == attempt._2 || step == null || util.isLeft(step)) {
480+
step = attempt._1.killed(util.fromLeft(interrupt))(v);
480481
} else {
481-
step = attempt._1.completed(util.fromRight(step))(attempt._2);
482+
step = attempt._1.completed(util.fromRight(step))(v);
482483
}
483484
} else if (fail) {
484-
step = attempt._1.failed(util.fromLeft(fail))(attempt._2);
485+
step = attempt._1.failed(util.fromLeft(fail))(v);
485486
} else {
486-
step = attempt._1.completed(util.fromRight(step))(attempt._2);
487+
step = attempt._1.completed(util.fromRight(step))(v);
487488
}
488489
fail = null;
489490
bracketCount++;

0 commit comments

Comments
 (0)