fix: respect the unidirectional nature of time (#14541)

* fix: respect the unidirectional nature of time

* note to our future selves
pull/14548/head
Rich Harris 3 weeks ago committed by GitHub
parent d511104ee0
commit 4e77bdef74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: respect the unidirectional nature of time

@ -4,10 +4,13 @@ import { raf } from './timing.js';
// TODO move this into timing.js where it probably belongs // TODO move this into timing.js where it probably belongs
/** /**
* @param {number} now
* @returns {void} * @returns {void}
*/ */
function run_tasks(now) { function run_tasks() {
// use `raf.now()` instead of the `requestAnimationFrame` callback argument, because
// otherwise things can get wonky https://github.com/sveltejs/svelte/pull/14541
const now = raf.now();
raf.tasks.forEach((task) => { raf.tasks.forEach((task) => {
if (!task.c(now)) { if (!task.c(now)) {
raf.tasks.delete(task); raf.tasks.delete(task);

Loading…
Cancel
Save