From a26b6d80ef734abbf3de4ebe22b838074f53f168 Mon Sep 17 00:00:00 2001 From: grieben <10453720+grieben@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:29:12 -0700 Subject: [PATCH] fix: overwrite #last_value when Spring is `.set()` with `{instant: true}` (#14656) * fix: overwrite #last_value when Spring is with * run npx changeset --- .changeset/shy-carpets-rescue.md | 5 +++++ packages/svelte/src/motion/spring.js | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/shy-carpets-rescue.md diff --git a/.changeset/shy-carpets-rescue.md b/.changeset/shy-carpets-rescue.md new file mode 100644 index 0000000000..0c7fc6687c --- /dev/null +++ b/.changeset/shy-carpets-rescue.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +Overwrite Spring.#last_value when using .set() with {instant: true} diff --git a/packages/svelte/src/motion/spring.js b/packages/svelte/src/motion/spring.js index 270fabd4c7..bc30ce9578 100644 --- a/packages/svelte/src/motion/spring.js +++ b/packages/svelte/src/motion/spring.js @@ -282,6 +282,7 @@ export class Spring { this.#task?.abort(); this.#task = null; set(this.#current, set(this.#target, value)); + this.#last_value = value; return Promise.resolve(); }