|
|
@@ -24,7 +24,7 @@ let index = 0
|
|
|
* Reset the scheduler's state.
|
|
|
*/
|
|
|
function resetSchedulerState () {
|
|
|
- queue.length = activatedChildren.length = 0
|
|
|
+ index = queue.length = activatedChildren.length = 0
|
|
|
has = {}
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
|
circular = {}
|
|
|
@@ -134,10 +134,10 @@ export function queueWatcher (watcher: Watcher) {
|
|
|
// if already flushing, splice the watcher based on its id
|
|
|
// if already past its id, it will be run next immediately.
|
|
|
let i = queue.length - 1
|
|
|
- while (i >= 0 && queue[i].id > watcher.id) {
|
|
|
+ while (i > index && queue[i].id > watcher.id) {
|
|
|
i--
|
|
|
}
|
|
|
- queue.splice(Math.max(i, index) + 1, 0, watcher)
|
|
|
+ queue.splice(i + 1, 0, watcher)
|
|
|
}
|
|
|
// queue the flush
|
|
|
if (!waiting) {
|