Skip to content

Commit 4e77bde

Browse files
authored
fix: respect the unidirectional nature of time (#14541)
* fix: respect the unidirectional nature of time * note to our future selves
1 parent d511104 commit 4e77bde

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/sixty-tables-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: respect the unidirectional nature of time

packages/svelte/src/internal/client/loop.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import { raf } from './timing.js';
44
// TODO move this into timing.js where it probably belongs
55

66
/**
7-
* @param {number} now
87
* @returns {void}
98
*/
10-
function run_tasks(now) {
9+
function run_tasks() {
10+
// use `raf.now()` instead of the `requestAnimationFrame` callback argument, because
11+
// otherwise things can get wonky https://github.com/sveltejs/svelte/pull/14541
12+
const now = raf.now();
13+
1114
raf.tasks.forEach((task) => {
1215
if (!task.c(now)) {
1316
raf.tasks.delete(task);

0 commit comments

Comments
 (0)