From 0164f87752ddad39b7b45f34256bf1fbf6754329 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Sun, 17 May 2020 01:46:13 -0700 Subject: [PATCH] fix: cache value & cancel tween for instant-set (#4847) --- src/runtime/motion/tweened.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/motion/tweened.ts b/src/runtime/motion/tweened.ts index abbb3b1aa276..c802604c0e27 100644 --- a/src/runtime/motion/tweened.ts +++ b/src/runtime/motion/tweened.ts @@ -94,7 +94,12 @@ export function tweened(value?: T, defaults: Options = {}): Tweened { } = assign(assign({}, defaults), opts); if (duration === 0) { - store.set(target_value); + if (previous_task) { + previous_task.abort(); + previous_task = null; + } + + store.set(value = target_value); return Promise.resolve(); }