Skip to content

Commit e5341ff

Browse files
authored
Merge pull request #336 from BackburnerJS/dropped-event
Fix for 332
2 parents fed33e7 + 398043c commit e5341ff

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/backburner/deferred-action-queues.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export default class DeferredActionQueues {
3737
throw new Error(`You attempted to schedule an action in a queue (${queueName}) for a method that doesn\'t exist`);
3838
}
3939

40+
this.queueNameIndex = 0;
41+
4042
if (onceFlag) {
4143
return queue.pushUnique(target, method, args, stack);
4244
} else {
@@ -66,7 +68,6 @@ export default class DeferredActionQueues {
6668
if (queue.flush(false /* async */) === QUEUE_STATE.Pause) {
6769
return QUEUE_STATE.Pause;
6870
}
69-
this.queueNameIndex = 0; // only reset to first queue if non-pause break
7071
}
7172
}
7273
}

tests/autorun-test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,28 @@ QUnit.test('autorun interleaved with microtasks do not get dropped [GH#332]', fu
104104

105105
bb.schedule('render', function() {
106106
actual.push('first');
107+
bb.schedule('actions', () => {
108+
actual.push('action1');
109+
});
107110

108111
Promise.resolve().then(() => {
109112
actual.push('second');
113+
bb.schedule('actions', () => {
114+
actual.push('action2');
115+
});
110116

111117
return Promise.resolve().then(() => {
112118
actual.push('third');
113119

114120
bb.schedule('actions', () => {
115-
actual.push('fourth');
121+
actual.push('action3');
116122
});
117123
});
118124
});
119125
});
120126

121127
setTimeout(function() {
122-
assert.deepEqual(actual, ['first', 'second', 'third', 'fourth']);
128+
assert.deepEqual(actual, ['first', 'action1', 'second', 'action2', 'third', 'action3']);
123129

124130
done();
125131
});

tests/debounce-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ QUnit.test('debounce', function(assert) {
4949
}, 110);
5050

5151
// great, we've made it this far, there's one more thing
52-
// we need to QUnit.test. we want to make sure we can call `debounce`
52+
// we need to test. we want to make sure we can call `debounce`
5353
// again with the same target/method after it has executed
5454

5555
// at the 120ms mark, let's schedule another call to `debounce`

0 commit comments

Comments
 (0)