From f0c33b5cb310727911ba752046cef12004c918bf Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 30 Jan 2019 15:33:35 -0500 Subject: [PATCH] better --- src/internal/scheduler.js | 3 ++- test/runtime/samples/lifecycle-next-tick/_config.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/internal/scheduler.js b/src/internal/scheduler.js index 717a5c7ff4..6c62af905c 100644 --- a/src/internal/scheduler.js +++ b/src/internal/scheduler.js @@ -10,7 +10,8 @@ const render_callbacks = []; export function schedule_update() { if (!update_promise) { - update_promise = Promise.resolve().then(flush); + update_promise = Promise.resolve(); + update_promise.then(flush); } } diff --git a/test/runtime/samples/lifecycle-next-tick/_config.js b/test/runtime/samples/lifecycle-next-tick/_config.js index 9ecd589d64..35a66f7a09 100644 --- a/test/runtime/samples/lifecycle-next-tick/_config.js +++ b/test/runtime/samples/lifecycle-next-tick/_config.js @@ -3,13 +3,13 @@ export default { const buttons = target.querySelectorAll('button'); const click = new window.MouseEvent('click'); - await (await buttons[0].dispatchEvent(click)); + await buttons[0].dispatchEvent(click); assert.deepEqual(component.snapshots, [ 'before 0', 'after 1' ]); - await (await buttons[0].dispatchEvent(click)); + await buttons[0].dispatchEvent(click); assert.deepEqual(component.snapshots, [ 'before 0', 'after 1', @@ -17,7 +17,7 @@ export default { 'after 2' ]); - await (await buttons[1].dispatchEvent(click)); + await buttons[1].dispatchEvent(click); assert.deepEqual(component.snapshots, [ 'before 0', 'after 1',